#==================================================================================
# Date: April 8, 2025
# European Economic Review EER
# Manuscript Number: EEREV-D-24-00361R1
# Author: Ingrid Mauerer, Socorro Puy, Sergi Urzay-Gomez
# Title: Explaining Preferences for EU Integration: Theory and Empirical Evidence
#==================================================================================

#==================
# Packages
#==================
library(car)
library(data.table)
library(doBy)
library(gridExtra)
library(haven)
library(itsadug)
library(plyr)

#==================
# Working Directory
#==================
setwd("...")


#==================
# Load data
#==================
load("EEREV-D-24-00361R1_data.RDS")


#---------------------------------------
# Table 1: Descriptive Statistics
#---------------------------------------
Table1 <- matrix(NA, 24, ncol = 11)
colnames(Table1) <- c("obs.", "delta", "x", "xn", "xiU", "e", "age", "female", "pop. size", "interest politics", "undeveloped")
rownames(Table1) <- c("Belgium", NA, 
                      "France", NA, 
                      "Italy", NA,
                      "Netherlands", NA,
                      "Germany", NA,
                      "UK", NA,
                      "Greece", NA,
                      "Portugal", NA,
                      "Spain", NA,
                      "Sweden", NA,
                      "Czech Republic", NA,
                      "Poland", NA)

# BE
Table1[1,]   <-c(nrow(BE), round(mean(BE$eu), digits=2), round(mean(BE$lr_self), digits=2), round(mean(BE$lr_nat), digits=2), 
                 round(mean(BE$lr_eu), digits=2), round(mean(BE$eco), digits=2), round(mean(BE$age), digits=2), 
                 round(mean(BE$gender), digits=2), round(mean(as.numeric(BE$pop)), digits=2),     
                 round(mean(as.numeric(BE$interest)), digits=2), round(mean(BE$undeveloped), digits=2))

Table1[2,]   <-c(NA, round(sd(BE$eu), digits=2), round(sd(BE$lr_self), digits=2), round(sd(BE$lr_nat), digits=2), 
                 round(sd(BE$lr_eu), digits=2), round(sd(BE$eco), digits=2), round(sd(BE$age), digits=2),
                 round(sd(BE$gender), digits=2),  round(sd(as.numeric(BE$pop)), digits=2),     
                 round(sd(as.numeric(BE$interest)), digits=2), round(sd(BE$undeveloped), digits=2))

# FR
Table1[3,]   <-c(nrow(FR), round(mean(FR$eu), digits=2), round(mean(FR$lr_self), digits=2), round(mean(FR$lr_nat), digits=2), 
                 round(mean(FR$lr_eu), digits=2), round(mean(FR$eco), digits=2), round(mean(FR$age), digits=2), 
                 round(mean(FR$gender), digits=2),  round(mean(as.numeric(FR$pop)), digits=2),     
                 round(mean(as.numeric(FR$interest)), digits=2), round(mean(FR$undeveloped), digits=2))

Table1[4,]   <-c(NA, round(sd(FR$eu), digits=2), round(sd(FR$lr_self), digits=2), round(sd(FR$lr_nat), digits=2), 
                 round(sd(FR$lr_eu), digits=2), round(sd(FR$eco), digits=2), round(sd(FR$age), digits=2),
                 round(sd(FR$gender), digits=2),  round(sd(as.numeric(FR$pop)), digits=2),     
                 round(sd(as.numeric(FR$interest)), digits=2), round(sd(FR$undeveloped), digits=2))

# IT
Table1[5,]   <-c(nrow(IT), round(mean(IT$eu), digits=2), round(mean(IT$lr_self), digits=2), round(mean(IT$lr_nat), digits=2), 
                 round(mean(IT$lr_eu), digits=2), round(mean(IT$eco), digits=2),     
                 round(mean(IT$age), digits=2), round(mean(IT$gender), digits=2),  round(mean(as.numeric(IT$pop)), digits=2),     
                 round(mean(as.numeric(IT$interest)), digits=2), round(mean(IT$undeveloped), digits=2))

Table1[6,]   <-c(NA, round(sd(IT$eu), digits=2), round(sd(IT$lr_self), digits=2), round(sd(IT$lr_nat), digits=2), 
                 round(sd(IT$lr_eu), digits=2), round(sd(IT$eco), digits=2),     
                 round(sd(IT$age), digits=2), round(sd(IT$gender), digits=2),  round(sd(as.numeric(IT$pop)), digits=2),     
                 round(sd(as.numeric(IT$interest)), digits=2), round(sd(IT$undeveloped), digits=2))

# NL
Table1[7,]   <-c(nrow(NL), round(mean(NL$eu), digits=2), round(mean(NL$lr_self), digits=2), round(mean(NL$lr_nat), digits=2), 
                 round(mean(NL$lr_eu), digits=2), round(mean(NL$eco), digits=2),     
                 round(mean(NL$age), digits=2), round(mean(NL$gender), digits=2),  round(mean(as.numeric(NL$pop)), digits=2),     
                 round(mean(as.numeric(NL$interest)), digits=2), round(mean(NL$undeveloped), digits=2))

Table1[8,]   <-c(NA, round(sd(NL$eu), digits=2), round(sd(NL$lr_self), digits=2), round(sd(NL$lr_nat), digits=2), 
                 round(sd(NL$lr_eu), digits=2), round(sd(NL$eco), digits=2),     
                 round(sd(NL$age), digits=2), round(sd(NL$gender), digits=2),  round(sd(as.numeric(NL$pop)), digits=2),     
                 round(sd(as.numeric(NL$interest)), digits=2), round(sd(NL$undeveloped), digits=2))

# DE
Table1[9,]   <-c(nrow(DE), round(mean(DE$eu), digits=2), round(mean(DE$lr_self), digits=2), round(mean(DE$lr_nat), digits=2), 
                 round(mean(DE$lr_eu), digits=2), round(mean(DE$eco), digits=2),     
                 round(mean(DE$age), digits=2), round(mean(DE$gender), digits=2),  round(mean(as.numeric(DE$pop)), digits=2),     
                 round(mean(as.numeric(DE$interest)), digits=2), round(mean(DE$undeveloped), digits=2))

Table1[10,]   <-c(NA, round(sd(DE$eu), digits=2), round(sd(DE$lr_self), digits=2), round(sd(DE$lr_nat), digits=2), 
                  round(sd(DE$lr_eu), digits=2), round(sd(DE$eco), digits=2),     
                  round(sd(DE$age), digits=2), round(sd(DE$gender), digits=2),  round(sd(as.numeric(DE$pop)), digits=2),     
                  round(sd(as.numeric(DE$interest)), digits=2), round(sd(DE$undeveloped), digits=2))

# UK
Table1[11,]   <-c(nrow(UK), round(mean(UK$eu), digits=2), round(mean(UK$lr_self), digits=2), round(mean(UK$lr_nat), digits=2), 
                  round(mean(UK$lr_eu), digits=2), round(mean(UK$eco), digits=2),     
                  round(mean(UK$age), digits=2), round(mean(UK$gender), digits=2),  round(mean(as.numeric(UK$pop)), digits=2),     
                  round(mean(as.numeric(UK$interest)), digits=2), round(mean(UK$undeveloped), digits=2))

Table1[12,]   <-c(NA, round(sd(UK$eu), digits=2), round(sd(UK$lr_self), digits=2), round(sd(UK$lr_nat), digits=2), 
                  round(sd(UK$lr_eu), digits=2), round(sd(UK$eco), digits=2),     
                  round(sd(UK$age), digits=2), round(sd(UK$gender), digits=2),  round(sd(as.numeric(UK$pop)), digits=2),     
                  round(sd(as.numeric(UK$interest)), digits=2), round(sd(UK$undeveloped), digits=2))

# GR
Table1[13,]   <-c(nrow(GR), round(mean(GR$eu), digits=2), round(mean(GR$lr_self), digits=2), round(mean(GR$lr_nat), digits=2), 
                  round(mean(GR$lr_eu), digits=2), round(mean(GR$eco), digits=2),     
                  round(mean(GR$age), digits=2), round(mean(GR$gender), digits=2),  round(mean(as.numeric(GR$pop)), digits=2),     
                  round(mean(as.numeric(GR$interest)), digits=2), round(mean(GR$undeveloped), digits=2))

Table1[14,]   <-c(NA, round(sd(GR$eu), digits=2), round(sd(GR$lr_self), digits=2), round(sd(GR$lr_nat), digits=2), 
                  round(sd(GR$lr_eu), digits=2), round(sd(GR$eco), digits=2),     
                  round(sd(GR$age), digits=2), round(sd(GR$gender), digits=2),  round(sd(as.numeric(GR$pop)), digits=2),     
                  round(sd(as.numeric(GR$interest)), digits=2), round(sd(GR$undeveloped), digits=2))

# PT
Table1[15,]   <-c(nrow(PT), round(mean(PT$eu), digits=2), round(mean(PT$lr_self), digits=2), round(mean(PT$lr_nat), digits=2), 
                  round(mean(PT$lr_eu), digits=2), round(mean(PT$eco), digits=2),     
                  round(mean(PT$age), digits=2), round(mean(PT$gender), digits=2),  round(mean(as.numeric(PT$pop)), digits=2),     
                  round(mean(as.numeric(PT$interest)), digits=2), round(mean(PT$undeveloped), digits=2))

Table1[16,]   <-c(NA, round(sd(PT$eu), digits=2), round(sd(PT$lr_self), digits=2), round(sd(PT$lr_nat), digits=2), 
                  round(sd(PT$lr_eu), digits=2), round(sd(PT$eco), digits=2),     
                  round(sd(PT$age), digits=2), round(sd(PT$gender), digits=2),  round(sd(as.numeric(PT$pop)), digits=2),     
                  round(sd(as.numeric(PT$interest)), digits=2), round(sd(PT$undeveloped), digits=2))

# ES
Table1[17,]   <-c(nrow(ES), round(mean(ES$eu), digits=2), round(mean(ES$lr_self), digits=2), round(mean(ES$lr_nat), digits=2), 
                  round(mean(ES$lr_eu), digits=2), round(mean(ES$eco), digits=2),     
                  round(mean(ES$age), digits=2), round(mean(ES$gender), digits=2),  round(mean(as.numeric(ES$pop)), digits=2),     
                  round(mean(as.numeric(ES$interest)), digits=2), round(mean(ES$undeveloped), digits=2))

Table1[18,]   <-c(NA, round(sd(ES$eu), digits=2), round(sd(ES$lr_self), digits=2), round(sd(ES$lr_nat), digits=2), 
                  round(sd(ES$lr_eu), digits=2), round(sd(ES$eco), digits=2),     
                  round(sd(ES$age), digits=2), round(sd(ES$gender), digits=2),  round(sd(as.numeric(ES$pop)), digits=2),     
                  round(sd(as.numeric(ES$interest)), digits=2), round(sd(ES$undeveloped), digits=2))

# SE
Table1[19,]   <-c(nrow(SE), round(mean(SE$eu), digits=2), round(mean(SE$lr_self), digits=2), round(mean(SE$lr_nat), digits=2), 
                  round(mean(SE$lr_eu), digits=2), round(mean(SE$eco), digits=2),     
                  round(mean(SE$age), digits=2), round(mean(SE$gender), digits=2),  round(mean(as.numeric(SE$pop)), digits=2),     
                  round(mean(as.numeric(SE$interest)), digits=2), round(mean(SE$undeveloped), digits=2))

Table1[20,]   <-c(NA, round(sd(SE$eu), digits=2), round(sd(SE$lr_self), digits=2), round(sd(SE$lr_nat), digits=2), 
                  round(sd(SE$lr_eu), digits=2), round(sd(SE$eco), digits=2),     
                  round(sd(SE$age), digits=2), round(sd(SE$gender), digits=2),  round(sd(as.numeric(SE$pop)), digits=2),     
                  round(sd(as.numeric(SE$interest)), digits=2), round(sd(SE$undeveloped), digits=2))

# CZ
Table1[21,]   <-c(nrow(CZ), round(mean(CZ$eu), digits=2), round(mean(CZ$lr_self), digits=2), round(mean(CZ$lr_nat), digits=2), 
                  round(mean(CZ$lr_eu), digits=2), round(mean(CZ$eco), digits=2),     
                  round(mean(CZ$age), digits=2), round(mean(CZ$gender), digits=2),  round(mean(as.numeric(CZ$pop)), digits=2),     
                  round(mean(as.numeric(CZ$interest)), digits=2), round(mean(CZ$undeveloped), digits=2))

Table1[22,]   <-c(NA, round(sd(CZ$eu), digits=2), round(sd(CZ$lr_self), digits=2), round(sd(CZ$lr_nat), digits=2), 
                  round(sd(CZ$lr_eu), digits=2), round(sd(CZ$eco), digits=2),     
                  round(sd(CZ$age), digits=2), round(sd(CZ$gender), digits=2),  round(sd(as.numeric(CZ$pop)), digits=2),     
                  round(sd(as.numeric(CZ$interest)), digits=2), round(sd(CZ$undeveloped), digits=2))

# PL
Table1[23,]   <-c(nrow(PL), round(mean(PL$eu), digits=2), round(mean(PL$lr_self), digits=2), round(mean(PL$lr_nat), digits=2), 
                  round(mean(PL$lr_eu), digits=2), round(mean(PL$eco), digits=2), round(mean(PL$age), digits=2), 
                  round(mean(PL$gender), digits=2),  round(mean(as.numeric(PL$pop)), digits=2),     
                  round(mean(as.numeric(PL$interest)), digits=2), round(mean(PL$undeveloped), digits=2))

Table1[24,]   <-c(NA, round(sd(PL$eu), digits=2), round(sd(PL$lr_self), digits=2), round(sd(PL$lr_nat), digits=2), 
                  round(sd(PL$lr_eu), digits=2), round(sd(PL$eco), digits=2), round(sd(PL$age), digits=2), 
                  round(sd(PL$gender), digits=2),  round(sd(as.numeric(PL$pop)), digits=2),     
                  round(sd(as.numeric(PL$interest)), digits=2), round(sd(PL$undeveloped), digits=2))

Table1


#---------------------------------------------------------------------
# Figure 4: Distribution of Ideal Citizen Ideology and Economic Status
#----------------------------------------------------------------------


#----------------------------------------------------------
# (a) Ideal Citizen Ideology xi (1 left, 11 right)
#----------------------------------------------------------
pdf(file="EEREV-D-24-00361R1_Figure_4a.pdf", width=10, height=4)
par(mfrow=c(2,6), mar=c(3.4,3.6,2.7,1.3), mgp=c(2.5,1,0))

# BE
hist(BE$lr_self, xlim = c(1, 11),  ylab="", xlab=expression("x" ["i"]), main="Belgium", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 11.5), xaxt='n', freq=FALSE, ylim=c(0,0.4))
axis(side=1, at=seq(1,11, 1), labels=seq(1,11,1))

# FR
hist(FR$lr_self, xlim = c(1, 11),  ylab="", xlab=expression("x" ["i"]), main="France", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 11.5), xaxt='n', freq=FALSE, ylim=c(0,0.4))
axis(side=1, at=seq(1,11, 1), labels=seq(1,11,1))

# IT
hist(IT$lr_self, xlim = c(1, 11),  ylab="", xlab=expression("x" ["i"]), main="Italy", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 11.5), xaxt='n', freq=FALSE, ylim=c(0,0.4))
axis(side=1, at=seq(1,11, 1), labels=seq(1,11,1))

# NL
hist(NL$lr_self, xlim = c(1, 11),  ylab="", xlab=expression("x" ["i"]), main="Netherlands", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 11.5), xaxt='n', freq=FALSE, ylim=c(0,0.4))
axis(side=1, at=seq(1,11, 1), labels=seq(1,11,1))

# DE
hist(DE$lr_self, xlim = c(1, 11),  ylab="", xlab=expression("x" ["i"]), main="Germany", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 11.5), xaxt='n', freq=FALSE, ylim=c(0,0.4))
axis(side=1, at=seq(1,11, 1), labels=seq(1,11,1))

# UK
hist(UK$lr_self, xlim = c(1, 11),  ylab="", xlab=expression("x" ["i"]), main="UK", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 11.5), xaxt='n', freq=FALSE, ylim=c(0,0.4))
axis(side=1, at=seq(1,11, 1), labels=seq(1,11,1))

# GR
hist(GR$lr_self, xlim = c(1, 11),  ylab="", xlab=expression("x" ["i"]), main="Greece", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 11.5), xaxt='n', freq=FALSE, ylim=c(0,0.4))
axis(side=1, at=seq(1,11, 1), labels=seq(1,11,1))

# PT
hist(PT$lr_self, xlim = c(1, 11),  ylab="", xlab=expression("x" ["i"]), main="Portugal", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 11.5), xaxt='n', freq=FALSE, ylim=c(0,0.4))
axis(side=1, at=seq(1,11, 1), labels=seq(1,11,1))

# ES
hist(ES$lr_self, xlim = c(1, 11),  ylab="", xlab=expression("x" ["i"]), main="Spain", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 11.5), xaxt='n', freq=FALSE, ylim=c(0,0.4))
axis(side=1, at=seq(1,11, 1), labels=seq(1,11,1))

# SE
hist(SE$lr_self, xlim = c(1, 11),  ylab="", xlab=expression("x" ["i"]), main="Sweden", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 11.5), xaxt='n', freq=FALSE, ylim=c(0,0.4))
axis(side=1, at=seq(1,11, 1), labels=seq(1,11,1))

# CZ
hist(CZ$lr_self, xlim = c(1, 11),  ylab="", xlab=expression("x" ["i"]), main="Czech Republic", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 11.5), xaxt='n', freq=FALSE, ylim=c(0,0.4))
axis(side=1, at=seq(1,11, 1), labels=seq(1,11,1))

# PL
hist(PL$lr_self, xlim = c(1, 11),  ylab="", xlab=expression("x" ["i"]), main="Poland", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 11.5), xaxt='n', freq=FALSE, ylim=c(0,0.4))
axis(side=1, at=seq(1,11, 1), labels=seq(1,11,1))


dev.off()



#----------------------------------------------------------
# (b) Economic Status ei (1 poor, 7 rich)
#----------------------------------------------------------
pdf(file="EEREV-D-24-00361R1_Figure_4b.pdf", width=10, height=4)
par(mfrow=c(2,6), mar=c(3.4,3.6,2.7,1.3), mgp=c(2.5,1,0))

# BE
hist(BE$eco, xlim = c(1, 7),  ylab="", xlab=expression("e" ["i"]), main="Belgium", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 7.5), xaxt='n', freq=FALSE, ylim=c(0,0.5))
axis(side=1, at=seq(1,7, 1), labels=seq(1,7,1))

# FR
hist(FR$eco, xlim = c(1, 7),  ylab="", xlab=expression("e" ["i"]), main="France", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 7.5), xaxt='n', freq=FALSE, ylim=c(0,0.5))
axis(side=1, at=seq(1,7, 1), labels=seq(1,7,1))

# IT
hist(IT$eco, xlim = c(1, 7),  ylab="", xlab=expression("e" ["i"]), main="Italy", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 7.5), xaxt='n', freq=FALSE, ylim=c(0,0.5))
axis(side=1, at=seq(1,7, 1), labels=seq(1,7,1))

# NL
hist(NL$eco, xlim = c(1, 7),  ylab="", xlab=expression("e" ["i"]), main="Netherlands", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 7.5), xaxt='n', freq=FALSE, ylim=c(0,0.5))
axis(side=1, at=seq(1,7, 1), labels=seq(1,7,1))

# DE
hist(DE$eco, xlim = c(1, 7),  ylab="", xlab=expression("e" ["i"]), main="Germany", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 7.5), xaxt='n', freq=FALSE, ylim=c(0,0.5))
axis(side=1, at=seq(1,7, 1), labels=seq(1,7,1))

# UK
hist(UK$eco, xlim = c(1, 7),  ylab="", xlab=expression("e" ["i"]), main="UK", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 7.5), xaxt='n', freq=FALSE, ylim=c(0,0.5))
axis(side=1, at=seq(1,7, 1), labels=seq(1,7,1))

# GR
hist(GR$eco, xlim = c(1, 7),  ylab="", xlab=expression("e" ["i"]), main="Greece", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 7.5), xaxt='n', freq=FALSE, ylim=c(0,0.5))
axis(side=1, at=seq(1,7, 1), labels=seq(1,7,1))

# PT
hist(PT$eco, xlim = c(1, 7),  ylab="", xlab=expression("e" ["i"]), main="Portugal", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 7.5), xaxt='n', freq=FALSE, ylim=c(0,0.5))
axis(side=1, at=seq(1,7, 1), labels=seq(1,7,1))

# ES
hist(ES$eco, xlim = c(1, 7),  ylab="", xlab=expression("e" ["i"]), main="Spain", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 7.5), xaxt='n', freq=FALSE, ylim=c(0,0.5))
axis(side=1, at=seq(1,7, 1), labels=seq(1,7,1))

# SE
hist(SE$eco, xlim = c(1, 7),  ylab="", xlab=expression("e" ["i"]), main="Sweden", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 7.5), xaxt='n', freq=FALSE, ylim=c(0,0.5))
axis(side=1, at=seq(1,7, 1), labels=seq(1,7,1))

# CZ
hist(CZ$eco, xlim = c(1, 7),  ylab="", xlab=expression("e" ["i"]), main="Czech Republic", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 7.5), xaxt='n', freq=FALSE, ylim=c(0,0.5))
axis(side=1, at=seq(1,7, 1), labels=seq(1,7,1))

# PL
hist(PL$eco, xlim = c(1, 7),  ylab="", xlab=expression("e" ["i"]), main="Poland", cex.lab=1, cex.axis=1, 
     breaks=seq(0.5, 7.5), xaxt='n', freq=FALSE, ylim=c(0,0.5))
axis(side=1, at=seq(1,7, 1), labels=seq(1,7,1))


dev.off()


#===================================================================================
# Estimations (for Table 3)
#===================================================================================
# - M1: Controls wi + f(ideoi)
# - M2: M1 + ei
# - M3: M1 + educationi
# - M4: M1 + ei + educationi

###############
# Belgium (BE)
###############

# Low Sophistication:
BE_l1 <- gam(eu ~ s(lr_self) +  aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_l1)

BE_l2 <- gam(eu ~ s(lr_self) +  eco + aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_l2)

BE_l3 <- gam(eu ~ s(lr_self) +  educ + aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_l3)

BE_l4 <- gam(eu ~ s(lr_self) +  eco + educ + aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_l4)


# Moderate Sophistication:
BE_m1 <- gam(eu ~ s(diseuself) +  aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_m1)

BE_m2 <- gam(eu ~ s(diseuself) +  eco + aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_m2)

BE_m3 <- gam(eu ~ s(diseuself) +  educ + aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_m3)

BE_m4 <- gam(eu ~ s(diseuself) +  eco + educ + aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_m4)


# High Sophistication:
BE_h1 <- gam(eu ~ s(lr_intervention) +  aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_h1)

BE_h2 <- gam(eu ~ s(lr_intervention) +  eco + aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_h2)

BE_h3 <- gam(eu ~ s(lr_intervention) +  educ + aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_h3)

BE_h4 <- gam(eu ~ s(lr_intervention) +  eco + educ + aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_h4)


###############
# France (FR)
###############

# Low Sophistication:
FR_l1 <- gam(eu ~ s(lr_self) +  aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_l1)

FR_l2 <- gam(eu ~ s(lr_self) +  eco + aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_l2)

FR_l3 <- gam(eu ~ s(lr_self) +  educ + aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_l3)

FR_l4 <- gam(eu ~ s(lr_self) +  eco + educ + aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_l4)


# Moderate Sophistication:
FR_m1 <- gam(eu ~ s(diseuself) +  aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_m1)

FR_m2 <- gam(eu ~ s(diseuself) +  eco + aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_m2)

FR_m3 <- gam(eu ~ s(diseuself) +  educ + aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_m3)

FR_m4 <- gam(eu ~ s(diseuself) +  eco + educ + aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_m4)


# High Sophistication:
FR_h1 <- gam(eu ~ s(lr_intervention) +  aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_h1)

FR_h2 <- gam(eu ~ s(lr_intervention) +  eco + aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_h2)

FR_h3 <- gam(eu ~ s(lr_intervention) +  educ + aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_h3)

FR_h4 <- gam(eu ~ s(lr_intervention) +  eco + educ + aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_h4)


###############
# Italy (IT)
###############

# Low Sophistication:
IT_l1 <- gam(eu ~ s(lr_self) +  aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_l1)

IT_l2 <- gam(eu ~ s(lr_self) +  eco + aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_l2)

IT_l3 <- gam(eu ~ s(lr_self) +  educ + aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_l3)

IT_l4 <- gam(eu ~ s(lr_self) +  eco + educ + aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_l4)


# Moderate Sophistication:
IT_m1 <- gam(eu ~ s(diseuself) +  aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_m1)

IT_m2 <- gam(eu ~ s(diseuself) +  eco + aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_m2)

IT_m3 <- gam(eu ~ s(diseuself) +  educ + aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_m3)

IT_m4 <- gam(eu ~ s(diseuself) +  eco + educ + aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_m4)


# High Sophistication:
IT_h1 <- gam(eu ~ s(lr_intervention) +  aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_h1)

IT_h2 <- gam(eu ~ s(lr_intervention) +  eco + aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_h2)

IT_h3 <- gam(eu ~ s(lr_intervention) +  educ + aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_h3)

IT_h4 <- gam(eu ~ s(lr_intervention) +  eco + educ + aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_h4)


###############
# Netherlands (NL)
###############

# Low Sophistication:
NL_l1 <- gam(eu ~ s(lr_self) +  aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_l1)

NL_l2 <- gam(eu ~ s(lr_self) +  eco + aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_l2)

NL_l3 <- gam(eu ~ s(lr_self) +  educ + aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_l3)

NL_l4 <- gam(eu ~ s(lr_self) +  eco + educ + aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_l4)


# Moderate Sophistication:
NL_m1 <- gam(eu ~ s(diseuself) +  aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_m1)

NL_m2 <- gam(eu ~ s(diseuself) +  eco + aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_m2)

NL_m3 <- gam(eu ~ s(diseuself) +  educ + aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_m3)

NL_m4 <- gam(eu ~ s(diseuself) +  eco + educ + aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_m4)


# High Sophistication:
NL_h1 <- gam(eu ~ s(lr_intervention) +  aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_h1)

NL_h2 <- gam(eu ~ s(lr_intervention) +  eco + aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_h2)

NL_h3 <- gam(eu ~ s(lr_intervention) +  educ + aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_h3)

NL_h4 <- gam(eu ~ s(lr_intervention) +  eco + educ + aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_h4)


###############
# Germany (DE)
###############

# Low Sophistication:
DE_l1 <- gam(eu ~ s(lr_self) +  aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_l1)

DE_l2 <- gam(eu ~ s(lr_self) +  eco + aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_l2)

DE_l3 <- gam(eu ~ s(lr_self) +  educ + aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_l3)

DE_l4 <- gam(eu ~ s(lr_self) +  eco + educ + aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_l4)


# Moderate Sophistication:
DE_m1 <- gam(eu ~ s(diseuself) +  aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_m1)

DE_m2 <- gam(eu ~ s(diseuself) +  eco + aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_m2)

DE_m3 <- gam(eu ~ s(diseuself) +  educ + aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_m3)

DE_m4 <- gam(eu ~ s(diseuself) +  eco + educ + aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_m4)


# High Sophistication:
DE_h1 <- gam(eu ~ s(lr_intervention) +  aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_h1)

DE_h2 <- gam(eu ~ s(lr_intervention) +  eco + aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_h2)

DE_h3 <- gam(eu ~ s(lr_intervention) +  educ + aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_h3)

DE_h4 <- gam(eu ~ s(lr_intervention) +  eco + educ + aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_h4)


###############
# United Kingdom (UK)
###############

# Low Sophistication:
UK_l1 <- gam(eu ~ s(lr_self) +  aged + gender + pop + interest + undeveloped, data=UK)
summary(UK_l1)

UK_l2 <- gam(eu ~ s(lr_self) +  eco + aged + gender + pop + interest + undeveloped, data=UK)
summary(UK_l2)

UK_l3 <- gam(eu ~ s(lr_self) +  educ + aged + gender + pop + interest + undeveloped, data=UK)
summary(UK_l3)

UK_l4 <- gam(eu ~ s(lr_self) +  eco + educ + aged + gender + pop + interest + undeveloped, data=UK)
summary(UK_l4)


# Moderate Sophistication:
UK_m1 <- gam(eu ~ s(diseuself) +  aged + gender + pop + interest + undeveloped, data=UK)
summary(UK_m1)

UK_m2 <- gam(eu ~ s(diseuself) +  eco + aged + gender + pop + interest + undeveloped, data=UK)
summary(UK_m2)

UK_m3 <- gam(eu ~ s(diseuself) +  educ + aged + gender + pop + interest + undeveloped, data=UK)
summary(UK_m3)

UK_m4 <- gam(eu ~ s(diseuself) +  eco + educ + aged + gender + pop + interest + undeveloped, data=UK)
summary(UK_m4)


# High Sophistication:
UK_h1 <- gam(eu ~ s(lr_intervention) +  aged + gender + pop + interest + undeveloped, data=UK)
summary(UK_h1)

UK_h2 <- gam(eu ~ s(lr_intervention) +  eco + aged + gender + pop + interest + undeveloped, data=UK)
summary(UK_h2)

UK_h3 <- gam(eu ~ s(lr_intervention) +  educ + aged + gender + pop + interest + undeveloped, data=UK)
summary(UK_h3)

UK_h4 <- gam(eu ~ s(lr_intervention) +  eco + educ + aged + gender + pop + interest + undeveloped, data=UK)
summary(UK_h4)


###############
# Greece (GR)
###############

# Low Sophistication:
GR_l1 <- gam(eu ~ s(lr_self) +  aged + gender + pop + interest + undeveloped, data=GR)
summary(GR_l1)

GR_l2 <- gam(eu ~ s(lr_self) +  eco + aged + gender + pop + interest + undeveloped, data=GR)
summary(GR_l2)

GR_l3 <- gam(eu ~ s(lr_self) +  educ + aged + gender + pop + interest + undeveloped, data=GR)
summary(GR_l3)

GR_l4 <- gam(eu ~ s(lr_self) +  eco + educ + aged + gender + pop + interest + undeveloped, data=GR)
summary(GR_l4)


# Moderate Sophistication:
GR_m1 <- gam(eu ~ s(diseuself) +  aged + gender + pop + interest + undeveloped, data=GR)
summary(GR_m1)

GR_m2 <- gam(eu ~ s(diseuself) +  eco + aged + gender + pop + interest + undeveloped, data=GR)
summary(GR_m2)

GR_m3 <- gam(eu ~ s(diseuself) +  educ + aged + gender + pop + interest + undeveloped, data=GR)
summary(GR_m3)

GR_m4 <- gam(eu ~ s(diseuself) +  eco + educ + aged + gender + pop + interest + undeveloped, data=GR)
summary(GR_m4)



# High Sophistication:
GR_h1 <- gam(eu ~ s(lr_intervention) +  aged + gender + pop + interest + undeveloped, data=GR)
summary(GR_h1)

GR_h2 <- gam(eu ~ s(lr_intervention) +  eco + aged + gender + pop + interest + undeveloped, data=GR)
summary(GR_h2)

GR_h3 <- gam(eu ~ s(lr_intervention) +  educ + aged + gender + pop + interest + undeveloped, data=GR)
summary(GR_h3)

GR_h4 <- gam(eu ~ s(lr_intervention) +  eco + educ + aged + gender + pop + interest + undeveloped, data=GR)
summary(GR_h4)


###############
# Portugal (PT)
###############

# Low Sophistication:
PT_l1 <- gam(eu ~ s(lr_self) +  aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_l1)

PT_l2 <- gam(eu ~ s(lr_self) +  eco + aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_l2)

PT_l3 <- gam(eu ~ s(lr_self) +  educ + aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_l3)

PT_l4 <- gam(eu ~ s(lr_self) +  eco + educ + aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_l4)


# Moderate Sophistication:
PT_m1 <- gam(eu ~ s(diseuself) +  aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_m1)

PT_m2 <- gam(eu ~ s(diseuself) +  eco + aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_m2)

PT_m3 <- gam(eu ~ s(diseuself) +  educ + aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_m3)

PT_m4 <- gam(eu ~ s(diseuself) +  eco + educ + aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_m4)


# High Sophistication:
PT_h1 <- gam(eu ~ s(lr_intervention) +  aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_h1)

PT_h2 <- gam(eu ~ s(lr_intervention) +  eco + aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_h2)

PT_h3 <- gam(eu ~ s(lr_intervention) +  educ + aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_h3)

PT_h4 <- gam(eu ~ s(lr_intervention) +  eco + educ + aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_h4)



###############
# Spain (ES)
###############

# Low Sophistication:
ES_l1 <- gam(eu ~ s(lr_self) +  aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_l1)

ES_l2 <- gam(eu ~ s(lr_self) +  eco + aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_l2)

ES_l3 <- gam(eu ~ s(lr_self) +  educ + aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_l3)

ES_l4 <- gam(eu ~ s(lr_self) +  eco + educ + aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_l4)


# Moderate Sophistication:
ES_m1 <- gam(eu ~ s(diseuself) +  aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_m1)

ES_m2 <- gam(eu ~ s(diseuself) +  eco + aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_m2)

ES_m3 <- gam(eu ~ s(diseuself) +  educ + aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_m3)

ES_m4 <- gam(eu ~ s(diseuself) +  eco + educ + aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_m4)


# High Sophistication:
ES_h1 <- gam(eu ~ s(lr_intervention) +  aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_h1)

ES_h2 <- gam(eu ~ s(lr_intervention) +  eco + aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_h2)

ES_h3 <- gam(eu ~ s(lr_intervention) +  educ + aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_h3)

ES_h4 <- gam(eu ~ s(lr_intervention) +  eco + educ + aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_h4)


###############
# Sweden (SE)
###############

# Low Sophistication:
SE_l1 <- gam(eu ~ s(lr_self) +  aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_l1)

SE_l2 <- gam(eu ~ s(lr_self) +  eco + aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_l2)

SE_l3 <- gam(eu ~ s(lr_self) +  educ + aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_l3)

SE_l4 <- gam(eu ~ s(lr_self) +  eco + educ + aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_l4)



# Moderate Sophistication:
SE_m1 <- gam(eu ~ s(diseuself) +  aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_m1)

SE_m2 <- gam(eu ~ s(diseuself) +  eco + aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_m2)

SE_m3 <- gam(eu ~ s(diseuself) +  educ + aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_m3)

SE_m4 <- gam(eu ~ s(diseuself) +  eco + educ + aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_m4)


# High Sophistication:
SE_h1 <- gam(eu ~ s(lr_intervention) +  aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_h1)

SE_h2 <- gam(eu ~ s(lr_intervention) +  eco + aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_h2)

SE_h3 <- gam(eu ~ s(lr_intervention) +  educ + aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_h3)

SE_h4 <- gam(eu ~ s(lr_intervention) +  eco + educ + aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_h4)


###############
# Czech Republic (CZ)
###############

# Low Sophistication:
CZ_l1 <- gam(eu ~ s(lr_self) +  aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_l1)

CZ_l2 <- gam(eu ~ s(lr_self) +  eco + aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_l2)

CZ_l3 <- gam(eu ~ s(lr_self) +  educ + aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_l3)

CZ_l4 <- gam(eu ~ s(lr_self) +  eco + educ + aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_l4)


# Moderate Sophistication:
CZ_m1 <- gam(eu ~ s(diseuself) +  aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_m1)

CZ_m2 <- gam(eu ~ s(diseuself) +  eco + aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_m2)

CZ_m3 <- gam(eu ~ s(diseuself) +  educ + aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_m3)

CZ_m4 <- gam(eu ~ s(diseuself) +  eco + educ + aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_m4)


# High Sophistication:
CZ_h1 <- gam(eu ~ s(lr_intervention) +  aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_h1)

CZ_h2 <- gam(eu ~ s(lr_intervention) +  eco + aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_h2)

CZ_h3 <- gam(eu ~ s(lr_intervention) +  educ + aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_h3)

CZ_h4 <- gam(eu ~ s(lr_intervention) +  eco + educ + aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_h4)


###############
# Poland (PL)
###############

# Low Sophistication:
PL_l1 <- gam(eu ~ s(lr_self) +  aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_l1)

PL_l2 <- gam(eu ~ s(lr_self) +  eco + aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_l2)

PL_l3 <- gam(eu ~ s(lr_self) +  educ + aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_l3)

PL_l4 <- gam(eu ~ s(lr_self) +  eco + educ + aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_l4)


# Moderate Sophistication:
PL_m1 <- gam(eu ~ s(diseuself) +  aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_m1)

PL_m2 <- gam(eu ~ s(diseuself) +  eco + aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_m2)

PL_m3 <- gam(eu ~ s(diseuself) +  educ + aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_m3)

PL_m4 <- gam(eu ~ s(diseuself) +  eco + educ + aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_m4)



# High Sophistication:
PL_h1 <- gam(eu ~ s(lr_intervention) +  aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_h1)

PL_h2 <- gam(eu ~ s(lr_intervention) +  eco + aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_h2)

PL_h3 <- gam(eu ~ s(lr_intervention) +  educ + aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_h3)

PL_h4 <- gam(eu ~ s(lr_intervention) +  eco + educ + aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_h4)


#------------------------------------------------------------------------------------
# Table 3: Explaining Individual Preferences for EU Integration: Model Comparisons
#------------------------------------------------------------------------------------

Table3 <- matrix(NA, 48, ncol = 3)
colnames(Table3) <- c("Low", "Moderate", "High")
rownames(Table3) <- c("Belgium M1: Controls + ideo", "M2: M1 + eco", "M3: M1 + educ", "M4: M1 + eco + educ",
                      "France M1:  Controls + ideo", "M2: M1 + eco", "M3: M1 + educ", "M4: M1 + eco + educ",
                      "Italy M1:   Controls + ideo", "M2: M1 + eco", "M3: M1 + educ", "M4: M1 + eco + educ",
                      "Netherlands M1: Controls + ideo", "M2: M1 + eco", "M3: M1 + educ", "M4: M1 + eco + educ",
                      "Germany M1: Controls + ideo", "M2: M1 + eco", "M3: M1 + educ", "M4: M1 + eco + educ",
                      "UK M1: Controls + ideo", "M2: M1 + eco", "M3: M1 + educ", "M4: M1 + eco + educ",
                      "Greece M1: Controls + ideo", "M2: M1 + eco", "M3: M1 + educ", "M4: M1 + eco + educ",
                      "Portugal M1: Controls + ideo", "M2: M1 + eco", "M3: M1 + educ", "M4: M1 + eco + educ",
                      "Spain M1: Controls + ideo", "M2: M1 + eco", "M3: M1 + educ", "M4: M1 + eco + educ",
                      "Sweden M1: Controls + ideo", "M2: M1 + eco", "M3: M1 + educ", "M4: M1 + eco + educ",
                      "Czech Republic M1: Controls + ideo", "M2: M1 + eco", "M3: M1 + educ", "M4: M1 + eco + educ",
                      "Poland M1: Controls + ideo", "M2: M1 + eco", "M3: M1 + educ", "M4: M1 + eco + educ")


Table3[,1] <- round(c(BIC(BE_l1), BIC(BE_l2), BIC(BE_l3), BIC(BE_l4),
                      BIC(FR_l1), BIC(FR_l2), BIC(FR_l3), BIC(FR_l4),
                      BIC(IT_l1), BIC(IT_l2), BIC(IT_l3), BIC(IT_l4),
                      BIC(NL_l1), BIC(NL_l2), BIC(NL_l3), BIC(NL_l4),
                      BIC(DE_l1), BIC(DE_l2), BIC(DE_l3), BIC(DE_l4),
                      BIC(UK_l1), BIC(UK_l2), BIC(UK_l3), BIC(UK_l4),
                      BIC(GR_l1), BIC(GR_l2), BIC(GR_l3), BIC(GR_l4),
                      BIC(PT_l1), BIC(PT_l2), BIC(PT_l3), BIC(PT_l4),
                      BIC(ES_l1), BIC(ES_l2), BIC(ES_l3), BIC(ES_l4),
                      BIC(SE_l1), BIC(SE_l2), BIC(SE_l3), BIC(SE_l4),
                      BIC(CZ_l1), BIC(CZ_l2), BIC(CZ_l3), BIC(CZ_l4),
                      BIC(PL_l1), BIC(PL_l2), BIC(PL_l3), BIC(PL_l4)), digits=2)


Table3[,2] <- round(c(BIC(BE_m1), BIC(BE_m2), BIC(BE_m3), BIC(BE_m4),
                      BIC(FR_m1), BIC(FR_m2), BIC(FR_m3), BIC(FR_m4),
                      BIC(IT_m1), BIC(IT_m2), BIC(IT_m3), BIC(IT_m4),
                      BIC(NL_m1), BIC(NL_m2), BIC(NL_m3), BIC(NL_m4),
                      BIC(DE_m1), BIC(DE_m2), BIC(DE_m3), BIC(DE_m4),
                      BIC(UK_m1), BIC(UK_m2), BIC(UK_m3), BIC(UK_m4),
                      BIC(GR_m1), BIC(GR_m2), BIC(GR_m3), BIC(GR_m4),
                      BIC(PT_m1), BIC(PT_m2), BIC(PT_m3), BIC(PT_m4),
                      BIC(ES_m1), BIC(ES_m2), BIC(ES_m3), BIC(ES_m4),
                      BIC(SE_m1), BIC(SE_m2), BIC(SE_m3), BIC(SE_m4),
                      BIC(CZ_m1), BIC(CZ_m2), BIC(CZ_m3), BIC(CZ_m4),
                      BIC(PL_m1), BIC(PL_m2), BIC(PL_m3), BIC(PL_m4)), digits=2)


Table3[,3] <- round(c(BIC(BE_h1), BIC(BE_h2), BIC(BE_h3), BIC(BE_h4),
                      BIC(FR_h1), BIC(FR_h2), BIC(FR_h3), BIC(FR_h4),
                      BIC(IT_h1), BIC(IT_h2), BIC(IT_h3), BIC(IT_h4),
                      BIC(NL_h1), BIC(NL_h2), BIC(NL_h3), BIC(NL_h4),
                      BIC(DE_h1), BIC(DE_h2), BIC(DE_h3), BIC(DE_h4),
                      BIC(UK_h1), BIC(UK_h2), BIC(UK_h3), BIC(UK_h4),
                      BIC(GR_h1), BIC(GR_h2), BIC(GR_h3), BIC(GR_h4),
                      BIC(PT_h1), BIC(PT_h2), BIC(PT_h3), BIC(PT_h4),
                      BIC(ES_h1), BIC(ES_h2), BIC(ES_h3), BIC(ES_h4),
                      BIC(SE_h1), BIC(SE_h2), BIC(SE_h3), BIC(SE_h4),
                      BIC(CZ_h1), BIC(CZ_h2), BIC(CZ_h3), BIC(CZ_h4),
                      BIC(PL_h1), BIC(PL_h2), BIC(PL_h3), BIC(PL_h4)), digits=2)

Table3


#-----------------------------------------------------------------------------
# Table 4: Ideological Effects s(ideo_i) and Economic Effects (e_i) using M2
#-----------------------------------------------------------------------------
Table4 <- matrix(NA, 12 , ncol = 6)
colnames(Table4) <- rep(c("edf", "eco: coef"), times=3)
rownames(Table4) <- c("Belgium","France","Italy","Netherlands", "Germany","UK","Greece","Portugal",
                       "Spain","Sweden","Czech Republic","Poland")

# low
# edf
Table4[,1] <- round(c(summary(BE_l2)$s.table[1], 
                      summary(FR_l2)$s.table[1], 
                      summary(IT_l2)$s.table[1], 
                      summary(NL_l2)$s.table[1], 
                      summary(DE_l2)$s.table[1], 
                      summary(UK_l2)$s.table[1], 
                      summary(GR_l2)$s.table[1], 
                      summary(PT_l2)$s.table[1], 
                      summary(ES_l2)$s.table[1], 
                      summary(SE_l2)$s.table[1],
                      summary(CZ_l2)$s.table[1], 
                      summary(PL_l2)$s.table[1]), digits=2)

# eco: coef
Table4[,2] <- round(c(BE_l2$coefficients[2],
                      FR_l2$coefficients[2], 
                      IT_l2$coefficients[2], 
                      NL_l2$coefficients[2], 
                      DE_l2$coefficients[2], 
                      UK_l2$coefficients[2], 
                      GR_l2$coefficients[2], 
                      PT_l2$coefficients[2], 
                      ES_l2$coefficients[2], 
                      SE_l2$coefficients[2], 
                      CZ_l2$coefficients[2], 
                      PL_l2$coefficients[2]), digits = 2)

# moderate
# edf
Table4[,3] <- round(c(summary(BE_m2)$s.table[1], 
                      summary(FR_m2)$s.table[1], 
                      summary(IT_m2)$s.table[1], 
                      summary(NL_m2)$s.table[1], 
                      summary(DE_m2)$s.table[1], 
                      summary(UK_m2)$s.table[1], 
                      summary(GR_m2)$s.table[1], 
                      summary(PT_m2)$s.table[1], 
                      summary(ES_m2)$s.table[1], 
                      summary(SE_m2)$s.table[1],
                      summary(CZ_m2)$s.table[1], 
                      summary(PL_m2)$s.table[1]), digits=2)

# eco: coef
Table4[,4] <- round(c(BE_m2$coefficients[2],
                      FR_m2$coefficients[2], 
                      IT_m2$coefficients[2], 
                      NL_m2$coefficients[2], 
                      DE_m2$coefficients[2], 
                      UK_m2$coefficients[2], 
                      GR_m2$coefficients[2], 
                      PT_m2$coefficients[2], 
                      ES_m2$coefficients[2], 
                      SE_m2$coefficients[2], 
                      CZ_m2$coefficients[2], 
                      PL_m2$coefficients[2]), digits = 2)
# high
# edf
Table4[,5] <- round(c(summary(BE_h2)$s.table[1], 
                      summary(FR_h2)$s.table[1], 
                      summary(IT_h2)$s.table[1], 
                      summary(NL_h2)$s.table[1], 
                      summary(DE_h2)$s.table[1], 
                      summary(UK_h2)$s.table[1], 
                      summary(GR_h2)$s.table[1], 
                      summary(PT_h2)$s.table[1], 
                      summary(ES_h2)$s.table[1], 
                      summary(SE_h2)$s.table[1],
                      summary(CZ_h2)$s.table[1], 
                      summary(PL_h2)$s.table[1]), digits=2)

# eco: coef
Table4[,6] <- round(c(BE_h2$coefficients[2],
                       FR_h2$coefficients[2], 
                       IT_h2$coefficients[2], 
                       NL_h2$coefficients[2], 
                       DE_h2$coefficients[2], 
                       UK_h2$coefficients[2], 
                       GR_h2$coefficients[2], 
                       PT_h2$coefficients[2], 
                       ES_h2$coefficients[2], 
                       SE_h2$coefficients[2], 
                       CZ_h2$coefficients[2], 
                       PL_h2$coefficients[2]), digits = 2)
Table4


#------------------------------------------------------------------------------------
# Figure 5: Smooth Terms for Ideological Considerations in the Three Settings (M2)
#------------------------------------------------------------------------------------  
#  Based on M2

xl <-expression("ideo" ["i"])

#-------------------------
# (a) Low Sophistication
#-------------------------

pdf(file="EEREV-D-24-00361R1_Figure_5a.pdf", width=9, height=3.8)
par(mfrow=c(2,5), mar=c(3.4,3.6,2.7,1.3), mgp=c(2.5,1,0))

# PL
hist(PL$lr_self, xlim = c(1, 11), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(0.5, 11.5))
par(new=TRUE)
plot(PL_l2, main="Poland", xlab=xl, xlim = c(1, 11), ylim=c(-4,6), 
     cex.main=1, ylab=expression(s("ideo" ["i"]*", 1.13")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# IT
hist(IT$lr_self, xlim = c(1, 11), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(0.5, 11.5))
par(new=TRUE)
plot(IT_l2, main="Italy",  xlim = c(1, 11), ylim=c(-4,6), xlab=xl,
     cex.main=1, ylab=expression(s("ideo" ["i"]*", 1.14")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey", lty=2)

# UK
hist(UK$lr_self, xlim = c(1, 11), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(0.5, 11.5))
par(new=TRUE)
plot(UK_l2, main="UK", xlab=xl, xlim = c(1, 11), ylim=c(-4,6),
     cex.main=1, ylab=expression(s("ideo" ["i"]*", 2.11")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# DE 
hist(DE$lr_self, xlim = c(1, 11), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(0.5, 11.5))
par(new=TRUE)
plot(DE_l2, main="Germany", xlab=xl, xlim = c(1, 11), ylim=c(-4,6), 
     cex.main=1, ylab=expression(s("ideo" ["i"]*", 2.38")),  cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# NL
hist(NL$lr_self, xlim = c(1, 11), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(0.5, 11.5))
par(new=TRUE)
plot(NL_l2, main="Netherlands", xlab=xl, xlim = c(1, 11), ylim=c(-4,6), 
     cex.main=1, ylab=expression(s("ideo" ["i"]*", 2.42")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# BE
hist(BE$lr_self, xlim = c(1, 11), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(0.5, 11.5))
par(new=TRUE)
plot(BE_l2, main="Belgium", xlab=xl, xlim = c(1, 11), ylim=c(-4,6), 
     cex.main=1, ylab=expression(s("ideo" ["i"]*", 3.23")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# SE
hist(SE$lr_self, xlim = c(1, 11), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(0.5, 11.5))
par(new=TRUE)
plot(SE_l2, main="Sweden", xlab=xl, xlim = c(1, 11), ylim=c(-4,6), 
     cex.main=1, ylab=expression(s("ideo" ["i"]*", 3.84")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# CZ
hist(CZ$lr_self, xlim = c(1, 11), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(0.5, 11.5))
par(new=TRUE)
plot(CZ_l2, main="Czech Republic", xlab=xl, xlim = c(1, 11), ylim=c(-4,6), 
     cex.main=1, ylab=expression(s("ideo" ["i"]*", 4.69")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# FR
hist(FR$lr_self, xlim = c(1, 11), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(0.5, 11.5))
par(new=TRUE)
plot(FR_l2, main="France", xlab=xl, xlim = c(1, 11), ylim=c(-4,6), 
     cex.main=1, ylab=expression(s("ideo" ["i"]*", 6.17")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# PT
hist(PT$lr_self, xlim = c(1, 11), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(0.5, 11.5))
par(new=TRUE)
plot(PT_l2, main="Portugal", xlab=xl, xlim = c(1, 11), ylim=c(-4,6), 
     cex.main=1, ylab=expression(s("ideo" ["i"]*", 7.30")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")


dev.off()



#---------------------------------
# (b) Moderate Sophistication
#---------------------------------

pdf(file="EEREV-D-24-00361R1_Figure_5b.pdf",width=9, height=3.8)
par(mfrow=c(2,5), mar=c(3.4,3.6,2.7,1.3), mgp=c(2.5,1,0))

# NL
hist(NL$diseuself, xlim = c(0, 10), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(-0.5, 10.5))
par(new=TRUE)
plot(NL_m2, main="Netherlands", xlab=xl, xlim = c(0, 10), ylim=c(-4,3), cex.main=1, 
     ylab=expression(s("ideo" ["i"]*", 1")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# DE
hist(DE$diseuself, xlim = c(0, 10), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(-0.5, 10.5))
par(new=TRUE)
plot(DE_m2, main="Germany", xlab=xl, xlim = c(0, 10), ylim=c(-4,3), cex.main=1, 
     ylab=expression(s("ideo" ["i"]*", 1")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# SE
hist(SE$diseuself, xlim = c(0, 10), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(-0.5, 10.5))
par(new=TRUE)
plot(SE_m2, main="Sweden", xlab=xl, xlim = c(0, 10), ylim=c(-4,3), cex.main=1, 
     ylab=expression(s("ideo" ["i"]*", 1.40")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# BE
hist(BE$diseuself, xlim = c(0, 10), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(-0.5, 10.5))
par(new=TRUE)
plot(BE_m2, main="Belgium", xlab=xl, xlim = c(0, 10), ylim=c(-4,3), cex.main=1, 
     ylab=expression(s("ideo" ["i"]*", 2.48")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# FR
hist(FR$diseuself, xlim = c(0, 10), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(-0.5, 10.5))
par(new=TRUE)
plot(FR_m2, main="France", xlab=xl, xlim = c(0, 10), ylim=c(-4,3), cex.main=1, 
     ylab=expression(s("ideo" ["i"]*", 3.27")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# PL 
hist(PL$diseuself, xlim = c(0, 10), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(-0.5, 10.5))
par(new=TRUE)
plot(PL_m2, main="Poland", xlab=xl, xlim = c(0, 10), ylim=c(-4,3), cex.main=1, 
     ylab=expression(s("ideo" ["i"]*", 3.60")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# ES
hist(ES$diseuself, xlim = c(0, 10), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(-0.5, 10.5))
par(new=TRUE)
plot(ES_m2, main="Spain", xlab=xl, xlim = c(0, 10), ylim=c(-4,3), cex.main=1, 
     ylab=expression(s("ideo" ["i"]*", 3.88")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# UK
hist(UK$diseuself, xlim = c(0, 10), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(-0.5, 10.5))
par(new=TRUE)
plot(UK_m2, main="UK", xlab=xl, xlim = c(0, 10), ylim=c(-4,3), cex.main=1, 
     ylab=expression(s("ideo" ["i"]*", 4.23")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# IT
hist(IT$diseuself, xlim = c(0, 10), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(-0.5, 10.5))
par(new=TRUE)
plot(IT_m2, main="Italy", xlab=xl, xlim = c(0, 10), ylim=c(-4,3), cex.main=1, 
     ylab=expression(s("ideo" ["i"]*", 4.77")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# CZ
hist(CZ$diseuself, xlim = c(0, 10), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(-0.5, 10.5))
par(new=TRUE)
plot(CZ_m2, main="Czech Republic", xlab=xl, xlim = c(0, 10), ylim=c(-4,3), cex.main=1, 
     ylab=expression(s("ideo" ["i"]*", 4.98")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")


dev.off()



#-----------------------------------------------
# (c) High Sophistication
#-----------------------------------------------

pdf(file="EEREV-D-24-00361R1_Figure_5c.pdf", width=9, height=3.8)
par(mfrow=c(2,5), mar=c(3.4,3.6,2.7,1.3), mgp=c(2.5,1,0))

# UK 
hist(UK$lr_intervention, xlim = c(-10, 10), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(-10.5, 10.5))
par(new=TRUE)
plot(UK_h2, main="UK", xlab=xl, xlim = c(-10, 10), ylim=c(-10,6), cex.main=1, 
     ylab=expression(s("ideo" ["i"]*", 1")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# DE
hist(DE$lr_intervention, xlim = c(-10, 10), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(-10.5, 10.5))
par(new=TRUE)
plot(DE_h2, main="Germany", xlab=xl, xlim = c(-10, 10), ylim=c(-10,6), cex.main=1, 
     ylab=expression(s("ideo" ["i"]*", 2.70")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# IT
hist(IT$lr_intervention, xlim = c(-10, 10), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(-10.5, 10.5))
par(new=TRUE)
plot(IT_h2, main="Italy", xlab=xl, xlim = c(-10, 10), ylim=c(-10,6), cex.main=1, 
     ylab=expression(s("ideo" ["i"]*", 2.86")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# PL
hist(PL$lr_intervention, xlim = c(-10, 10), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(-10.5, 10.5))
par(new=TRUE)
plot(PL_h2, main="Poland", xlab=xl, xlim = c(-10, 10), ylim=c(-10,6), cex.main=1, 
     ylab=expression(s("ideo" ["i"]*", 3.23")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# GR
hist(GR$lr_intervention, xlim = c(-10, 10), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(-10.5, 10.5))
par(new=TRUE)
plot(GR_h2, main="Greece", xlab=xl, xlim = c(-10, 10), ylim=c(-10,6), cex.main=1, 
     ylab=expression(s("ideo" ["i"]*", 3.30")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# NL
hist(NL$lr_intervention, xlim = c(-10, 10), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(-10.5, 10.5))
par(new=TRUE)
plot(NL_h2, main="Netherlands", xlab=xl, xlim = c(-10, 10), ylim=c(-10,6), cex.main=1, 
     ylab=expression(s("ideo" ["i"]*", 3.57")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# SE
hist(SE$lr_intervention, xlim = c(-10, 10), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(-10.5, 10.5))
par(new=TRUE)
plot(SE_h2, main="Sweden", xlab=xl, xlim = c(-10, 10), ylim=c(-10,6), cex.main=1, 
     ylab=expression(s("ideo" ["i"]*", 4.64")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# BE
hist(BE$lr_intervention, xlim = c(-10, 10), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(-10.5, 10.5))
par(new=TRUE)
plot(BE_h2, main="Belgium", xlab=xl, xlim = c(-10, 10), ylim=c(-10,6), cex.main=1, 
     ylab=expression(s("ideo" ["i"]*", 6.37")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# ES
hist(ES$lr_intervention, xlim = c(-10, 10), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(-10.5, 10.5))
par(new=TRUE)
plot(ES_h2, main="Spain", xlab=xl, xlim = c(-10, 10), ylim=c(-10,6), cex.main=1, 
     ylab=expression(s("ideo" ["i"]*", 6.93")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")

# FR
hist(FR$lr_intervention, xlim = c(-10, 10), col="white", border="grey", ylab="", xlab="", main="", yaxt='n', xaxt='n', 
     breaks=seq(-10.5, 10.5))
par(new=TRUE)
plot(FR_h2, main="France", xlab=xl, xlim = c(-10, 10), ylim=c(-10,6), cex.main=1, 
     ylab=expression(s("ideo" ["i"]*", 8.72")), cex.lab=1, cex.axis=1)
abline(h = 0, col="grey")


dev.off()




#=======================================================================================
# Estimations with Interactions
#=======================================================================================

# - int1: based on M2: interaction between ideo and eco
# - int2: based on M2: interaction between ideo and interest
# - int3: based on M3: interaction between ideo and educ


###############
# Belgium (BE)
###############

# Low Sophistication:

# based on M2: interaction between ideo and eco
BE_l2int1 <- gam(eu ~  s(lr_self) + s(lr_self, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_l2int1)  

# based on M2: interaction between ideo and interest
BE_l2int2 <- gam(eu ~ s(lr_self) + s(lr_self, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_l2int2) 

# based on M3: interaction between ideo and educ
BE_l3int3 <- gam(eu ~ s(lr_self) + s(lr_self, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_l3int3) 


# Moderate Sophistication:

# based on M2: interaction between ideo and eco
BE_m2int1 <- gam(eu ~  s(diseuself) + s(diseuself, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_m2int1)  

# based on M2: interaction between ideo and interest
BE_m2int2 <- gam(eu ~ s(diseuself) + s(diseuself, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_m2int2) 

# based on M3: interaction between ideo and educ
BE_m3int3 <- gam(eu ~ s(diseuself) + s(diseuself, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_m3int3)


# High Sophistication:

# based on M2: interaction between ideo and eco
BE_h2int1 <- gam(eu ~  s(lr_intervention) + s(lr_intervention, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_h2int1)  

# based on M2: interaction between ideo and interest
BE_h2int2 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_h2int2) 

# based on M3: interaction between ideo and educ
BE_h3int3 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_h3int3)


###############
# France (FR)
###############

# Low Sophistication:

# based on M2: interaction between ideo and eco
FR_l2int1 <- gam(eu ~  s(lr_self) + s(lr_self, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_l2int1)  

# based on M2: interaction between ideo and interest
FR_l2int2 <- gam(eu ~ s(lr_self) + s(lr_self, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_l2int2) 

# based on M3: interaction between ideo and educ
FR_l3int3 <- gam(eu ~ s(lr_self) + s(lr_self, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_l3int3) 


# Moderate Sophistication:

# based on M2: interaction between ideo and eco
FR_m2int1 <- gam(eu ~  s(diseuself) + s(diseuself, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_m2int1)  

# based on M2: interaction between ideo and interest
FR_m2int2 <- gam(eu ~ s(diseuself) + s(diseuself, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_m2int2) 

# based on M3: interaction between ideo and educ
FR_m3int3 <- gam(eu ~ s(diseuself) + s(diseuself, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_m3int3)


# High Sophistication:

# based on M2: interaction between ideo and eco
FR_h2int1 <- gam(eu ~  s(lr_intervention) + s(lr_intervention, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_h2int1)  

# based on M2: interaction between ideo and interest
FR_h2int2 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_h2int2) 

# based on M3: interaction between ideo and educ
FR_h3int3 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_h3int3)


###############
# Italy (IT)
###############

# Low Sophistication:

# based on M2: interaction between ideo and eco
IT_l2int1 <- gam(eu ~  s(lr_self) + s(lr_self, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_l2int1)  

# based on M2: interaction between ideo and interest
IT_l2int2 <- gam(eu ~ s(lr_self) + s(lr_self, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_l2int2) 

# based on M3: interaction between ideo and educ
IT_l3int3 <- gam(eu ~ s(lr_self) + s(lr_self, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_l3int3) 


# Moderate Sophistication:

# based on M2: interaction between ideo and eco
IT_m2int1 <- gam(eu ~  s(diseuself) + s(diseuself, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_m2int1)  

# based on M2: interaction between ideo and interest
IT_m2int2 <- gam(eu ~ s(diseuself) + s(diseuself, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_m2int2) 

# based on M3: interaction between ideo and educ
IT_m3int3 <- gam(eu ~ s(diseuself) + s(diseuself, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_m3int3)


# High Sophistication:

# based on M2: interaction between ideo and eco
IT_h2int1 <- gam(eu ~  s(lr_intervention) + s(lr_intervention, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_h2int1)  

# based on M2: interaction between ideo and interest
IT_h2int2 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_h2int2) 

# based on M3: interaction between ideo and educ
IT_h3int3 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_h3int3)


###############
# Netherlands (NL)
###############

# Low Sophistication:

# based on M2: interaction between ideo and eco
NL_l2int1 <- gam(eu ~  s(lr_self) + s(lr_self, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_l2int1)  

# based on M2: interaction between ideo and interest
NL_l2int2 <- gam(eu ~ s(lr_self) + s(lr_self, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_l2int2) 

# based on M3: interaction between ideo and educ
NL_l3int3 <- gam(eu ~ s(lr_self) + s(lr_self, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_l3int3) 


# Moderate Sophistication:

# based on M2: interaction between ideo and eco
NL_m2int1 <- gam(eu ~  s(diseuself) + s(diseuself, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_m2int1)  

# based on M2: interaction between ideo and interest
NL_m2int2 <- gam(eu ~ s(diseuself) + s(diseuself, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_m2int2) 

# based on M3: interaction between ideo and educ
NL_m3int3 <- gam(eu ~ s(diseuself) + s(diseuself, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_m3int3)


# High Sophistication:

# based on M2: interaction between ideo and eco
NL_h2int1 <- gam(eu ~  s(lr_intervention) + s(lr_intervention, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_h2int1)  

# based on M2: interaction between ideo and interest
NL_h2int2 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_h2int2) 

# based on M3: interaction between ideo and educ
NL_h3int3 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_h3int3)


###############
# Germany (DE)
###############

# Low Sophistication:

# based on M2: interaction between ideo and eco
DE_l2int1 <- gam(eu ~  s(lr_self) + s(lr_self, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_l2int1)  

# based on M2: interaction between ideo and interest
DE_l2int2 <- gam(eu ~ s(lr_self) + s(lr_self, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_l2int2) 

# based on M3: interaction between ideo and educ
DE_l3int3 <- gam(eu ~ s(lr_self) + s(lr_self, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_l3int3) 


# Moderate Sophistication:

# based on M2: interaction between ideo and eco
DE_m2int1 <- gam(eu ~  s(diseuself) + s(diseuself, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_m2int1)  

# based on M2: interaction between ideo and interest
DE_m2int2 <- gam(eu ~ s(diseuself) + s(diseuself, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_m2int2) 

# based on M3: interaction between ideo and educ
DE_m3int3 <- gam(eu ~ s(diseuself) + s(diseuself, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_m3int3)


# High Sophistication:

# based on M2: interaction between ideo and eco
DE_h2int1 <- gam(eu ~  s(lr_intervention) + s(lr_intervention, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_h2int1)  

# based on M2: interaction between ideo and interest
DE_h2int2 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_h2int2) 

# based on M3: interaction between ideo and educ
DE_h3int3 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_h3int3)


###############
# United Kingdom (UK)
###############

# Low Sophistication:

# based on M2: interaction between ideo and eco
UK_l2int1 <- gam(eu ~  s(lr_self) + s(lr_self, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=UK)
summary(UK_l2int1)  

# based on M2: interaction between ideo and interest
UK_l2int2 <- gam(eu ~ s(lr_self) + s(lr_self, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=UK)
summary(UK_l2int2) 

# based on M3: interaction between ideo and educ
UK_l3int3 <- gam(eu ~ s(lr_self) + s(lr_self, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=UK)
summary(UK_l3int3) 


# Moderate Sophistication:

# based on M2: interaction between ideo and eco
UK_m2int1 <- gam(eu ~  s(diseuself) + s(diseuself, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=UK)
summary(UK_m2int1)  

# based on M2: interaction between ideo and interest
UK_m2int2 <- gam(eu ~ s(diseuself) + s(diseuself, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=UK)
summary(UK_m2int2) 

# based on M3: interaction between ideo and educ
UK_m3int3 <- gam(eu ~ s(diseuself) + s(diseuself, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=UK)
summary(UK_m3int3)


# High Sophistication:

# based on M2: interaction between ideo and eco
UK_h2int1 <- gam(eu ~  s(lr_intervention) + s(lr_intervention, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=UK)
summary(UK_h2int1)  

# based on M2: interaction between ideo and interest
UK_h2int2 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=UK)
summary(UK_h2int2) 

# based on M3: interaction between ideo and educ
UK_h3int3 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=UK)
summary(UK_h3int3)


###############
# Greece (GR)
###############

# Low Sophistication:

# based on M2: interaction between ideo and eco
GR_l2int1 <- gam(eu ~  s(lr_self) + s(lr_self, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=GR)
summary(GR_l2int1)  

# based on M2: interaction between ideo and interest
GR_l2int2 <- gam(eu ~ s(lr_self) + s(lr_self, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=GR)
summary(GR_l2int2) 

# based on M3: interaction between ideo and educ
GR_l3int3 <- gam(eu ~ s(lr_self) + s(lr_self, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=GR)
summary(GR_l3int3) 


# Moderate Sophistication:

# based on M2: interaction between ideo and eco
GR_m2int1 <- gam(eu ~  s(diseuself) + s(diseuself, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=GR)
summary(GR_m2int1)  

# based on M2: interaction between ideo and interest
GR_m2int2 <- gam(eu ~ s(diseuself) + s(diseuself, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=GR)
summary(GR_m2int2) 

# based on M3: interaction between ideo and educ
GR_m3int3 <- gam(eu ~ s(diseuself) + s(diseuself, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=GR)
summary(GR_m3int3)


# High Sophistication:

# based on M2: interaction between ideo and eco
GR_h2int1 <- gam(eu ~  s(lr_intervention) + s(lr_intervention, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=GR)
summary(GR_h2int1)  

# based on M2: interaction between ideo and interest
GR_h2int2 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=GR)
summary(GR_h2int2) 

# based on M3: interaction between ideo and educ
GR_h3int3 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=GR)
summary(GR_h3int3)


###############
# Portugal (PT)
###############

# Low Sophistication:

# based on M2: interaction between ideo and eco
PT_l2int1 <- gam(eu ~  s(lr_self) + s(lr_self, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_l2int1)  

# based on M2: interaction between ideo and interest
PT_l2int2 <- gam(eu ~ s(lr_self) + s(lr_self, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_l2int2) 

# based on M3: interaction between ideo and educ
PT_l3int3 <- gam(eu ~ s(lr_self) + s(lr_self, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_l3int3) 


# Moderate Sophistication:

# based on M2: interaction between ideo and eco
PT_m2int1 <- gam(eu ~  s(diseuself) + s(diseuself, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_m2int1)  

# based on M2: interaction between ideo and interest
PT_m2int2 <- gam(eu ~ s(diseuself) + s(diseuself, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_m2int2) 

# based on M3: interaction between ideo and educ
PT_m3int3 <- gam(eu ~ s(diseuself) + s(diseuself, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_m3int3)


# High Sophistication:

# based on M2: interaction between ideo and eco
PT_h2int1 <- gam(eu ~  s(lr_intervention) + s(lr_intervention, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_h2int1)  

# based on M2: interaction between ideo and interest
PT_h2int2 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_h2int2) 

# based on M3: interaction between ideo and educ
PT_h3int3 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_h3int3)


###############
# Spain (ES)
###############

# Low Sophistication:

# based on M2: interaction between ideo and eco
ES_l2int1 <- gam(eu ~  s(lr_self) + s(lr_self, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_l2int1)  

# based on M2: interaction between ideo and interest
ES_l2int2 <- gam(eu ~ s(lr_self) + s(lr_self, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_l2int2) 

# based on M3: interaction between ideo and educ
ES_l3int3 <- gam(eu ~ s(lr_self) + s(lr_self, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_l3int3) 


# Moderate Sophistication:

# based on M2: interaction between ideo and eco
ES_m2int1 <- gam(eu ~  s(diseuself) + s(diseuself, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_m2int1)  

# based on M2: interaction between ideo and interest
ES_m2int2 <- gam(eu ~ s(diseuself) + s(diseuself, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_m2int2) 

# based on M3: interaction between ideo and educ
ES_m3int3 <- gam(eu ~ s(diseuself) + s(diseuself, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_m3int3)


# High Sophistication:

# based on M2: interaction between ideo and eco
ES_h2int1 <- gam(eu ~  s(lr_intervention) + s(lr_intervention, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_h2int1)  

# based on M2: interaction between ideo and interest
ES_h2int2 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_h2int2) 

# based on M3: interaction between ideo and educ
ES_h3int3 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_h3int3)


###############
# Sweden (SE)
###############

# Low Sophistication:

# based on M2: interaction between ideo and eco
SE_l2int1 <- gam(eu ~  s(lr_self) + s(lr_self, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_l2int1)  

# based on M2: interaction between ideo and interest
SE_l2int2 <- gam(eu ~ s(lr_self) + s(lr_self, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_l2int2) 

# based on M3: interaction between ideo and educ
SE_l3int3 <- gam(eu ~ s(lr_self) + s(lr_self, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_l3int3) 


# Moderate Sophistication:

# based on M2: interaction between ideo and eco
SE_m2int1 <- gam(eu ~  s(diseuself) + s(diseuself, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_m2int1)  

# based on M2: interaction between ideo and interest
SE_m2int2 <- gam(eu ~ s(diseuself) + s(diseuself, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_m2int2) 

# based on M3: interaction between ideo and educ
SE_m3int3 <- gam(eu ~ s(diseuself) + s(diseuself, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_m3int3)


# High Sophistication:

# based on M2: interaction between ideo and eco
SE_h2int1 <- gam(eu ~  s(lr_intervention) + s(lr_intervention, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_h2int1)  

# based on M2: interaction between ideo and interest
SE_h2int2 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_h2int2) 

# based on M3: interaction between ideo and educ
SE_h3int3 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_h3int3)


###############
# Czech Republic (CZ)
###############

# Low Sophistication:

# based on M2: interaction between ideo and eco
CZ_l2int1 <- gam(eu ~  s(lr_self) + s(lr_self, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_l2int1)  

# based on M2: interaction between ideo and interest
CZ_l2int2 <- gam(eu ~ s(lr_self) + s(lr_self, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_l2int2) 

# based on M3: interaction between ideo and educ
CZ_l3int3 <- gam(eu ~ s(lr_self) + s(lr_self, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_l3int3) 


# Moderate Sophistication:

# based on M2: interaction between ideo and eco
CZ_m2int1 <- gam(eu ~  s(diseuself) + s(diseuself, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_m2int1)  

# based on M2: interaction between ideo and interest
CZ_m2int2 <- gam(eu ~ s(diseuself) + s(diseuself, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_m2int2) 

# based on M3: interaction between ideo and educ
CZ_m3int3 <- gam(eu ~ s(diseuself) + s(diseuself, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_m3int3)


# High Sophistication:

# based on M2: interaction between ideo and eco
CZ_h2int1 <- gam(eu ~  s(lr_intervention) + s(lr_intervention, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_h2int1)  

# based on M2: interaction between ideo and interest
CZ_h2int2 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_h2int2) 

# based on M3: interaction between ideo and educ
CZ_h3int3 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_h3int3)


###############
# Poland (PL)
###############

# Low Sophistication:

# based on M2: interaction between ideo and eco
PL_l2int1 <- gam(eu ~  s(lr_self) + s(lr_self, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_l2int1)  

# based on M2: interaction between ideo and interest
PL_l2int2 <- gam(eu ~ s(lr_self) + s(lr_self, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_l2int2) 

# based on M3: interaction between ideo and educ
PL_l3int3 <- gam(eu ~ s(lr_self) + s(lr_self, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_l3int3) 


# Moderate Sophistication:

# based on M2: interaction between ideo and eco
PL_m2int1 <- gam(eu ~  s(diseuself) + s(diseuself, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_m2int1)  

# based on M2: interaction between ideo and interest
PL_m2int2 <- gam(eu ~ s(diseuself) + s(diseuself, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_m2int2) 

# based on M3: interaction between ideo and educ
PL_m3int3 <- gam(eu ~ s(diseuself) + s(diseuself, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_m3int3)


# High Sophistication:

# based on M2: interaction between ideo and eco
PL_h2int1 <- gam(eu ~  s(lr_intervention) + s(lr_intervention, by=eco) +  eco + aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_h2int1)  

# based on M2: interaction between ideo and interest
PL_h2int2 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=interest) + eco  + aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_h2int2) 

# based on M3: interaction between ideo and educ
PL_h3int3 <- gam(eu ~ s(lr_intervention) + s(lr_intervention, by=educ) + educ + aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_h3int3)




#=====================================================================================
# Robustness Checks
#=====================================================================================

#################
# Belgium (BE)
##################

#---------------------------
# Commission: based on M2
#---------------------------

# Moderate Sophistication:
BE_m2_com <- gam(eu ~ s(diseuself2) +  eco + aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_m2_com)


# High Sophistication:
BE_h2_com <- gam(eu ~ s(lr_intervention2) + eco + aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_h2_com)

#----------------------------------------------
# Distance between nation and self-placement:
#----------------------------------------------
BE_2_Rdis <- gam(eu ~ s(disnatself) + eco + aged + gender + pop + interest + undeveloped, data=BE)
summary(BE_2_Rdis)


#################
# France (FR)
##################

#---------------------------
# Commission: based on M2
#---------------------------

# Moderate Sophistication:
FR_m2_com <- gam(eu ~ s(diseuself2) +  eco + aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_m2_com)


# High Sophistication:
FR_h2_com <- gam(eu ~ s(lr_intervention2) + eco + aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_h2_com)

#----------------------------------------------
# Distance between nation and self-placement:
#----------------------------------------------
FR_2_Rdis <- gam(eu ~ s(disnatself) + eco + aged + gender + pop + interest + undeveloped, data=FR)
summary(FR_2_Rdis)


#################
# Italy (IT)
##################

#---------------------------
# Commission: based on M2
#---------------------------

# Moderate Sophistication:
IT_m2_com <- gam(eu ~ s(diseuself2) +  eco + aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_m2_com)


# High Sophistication:
IT_h2_com <- gam(eu ~ s(lr_intervention2) + eco + aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_h2_com)

#----------------------------------------------
# Distance between nation and self-placement:
#----------------------------------------------
IT_2_Rdis <- gam(eu ~ s(disnatself) + eco + aged + gender + pop + interest + undeveloped, data=IT)
summary(IT_2_Rdis)


#################
# Netherlands (NL)
##################

#---------------------------
# Commission: based on M2
#---------------------------

# Moderate Sophistication:
NL_m2_com <- gam(eu ~ s(diseuself2) +  eco + aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_m2_com)


# High Sophistication:
NL_h2_com <- gam(eu ~ s(lr_intervention2) + eco + aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_h2_com)

#----------------------------------------------
# Distance between nation and self-placement:
#----------------------------------------------
NL_2_Rdis <- gam(eu ~ s(disnatself) + eco + aged + gender + pop + interest + undeveloped, data=NL)
summary(NL_2_Rdis)


##################
# Germany (DE)
##################

#---------------------------
# Commission: based on M2
#---------------------------

# Moderate Sophistication:
DE_m2_com <- gam(eu ~ s(diseuself2) +  eco + aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_m2_com)


# High Sophistication:
DE_h2_com <- gam(eu ~ s(lr_intervention2) + eco + aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_h2_com)

#----------------------------------------------
# Distance between nation and self-placement:
#----------------------------------------------
DE_2_Rdis <- gam(eu ~ s(disnatself) + eco + aged + gender + pop + interest + undeveloped, data=DE)
summary(DE_2_Rdis)


#################
# United Kingdom (UK)
##################

#---------------------------
# Commission: based on M2
#---------------------------

# Moderate Sophistication:
UK_m2_com <- gam(eu ~ s(diseuself2) +  eco + aged + gender + pop + interest + undeveloped, data=UK)
summary(UK_m2_com)


# High Sophistication: inestimable

#----------------------------------------------
# Distance between nation and self-placement:
#----------------------------------------------
UK_2_Rdis <- gam(eu ~ s(disnatself) + eco + aged + gender + pop + interest + undeveloped, data=UK)
summary(UK_2_Rdis)


#################
# Greece (GR)
##################

#---------------------------
# Commission: based on M2
#---------------------------

# Moderate Sophistication:
GR_m2_com <- gam(eu ~ s(diseuself2) +  eco + aged + gender + pop + interest + undeveloped, data=GR)
summary(GR_m2_com)


# High Sophistication: inestimable

#----------------------------------------------
# Distance between nation and self-placement:
#----------------------------------------------
GR_2_Rdis <- gam(eu ~ s(disnatself) + eco + aged + gender + pop + interest + undeveloped, data=GR)
summary(GR_2_Rdis)


#################
# Portugal (PT)
##################

#---------------------------
# Commission: based on M2
#---------------------------

# Moderate Sophistication:
PT_m2_com <- gam(eu ~ s(diseuself2) +  eco + aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_m2_com)


# High Sophistication:
PT_h2_com <- gam(eu ~ s(lr_intervention2) + eco + aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_h2_com)

#----------------------------------------------
# Distance between nation and self-placement:
#----------------------------------------------
PT_2_Rdis <- gam(eu ~ s(disnatself) + eco + aged + gender + pop + interest + undeveloped, data=PT)
summary(PT_2_Rdis)


#################
# Spain (ES)
##################

#---------------------------
# Commission: based on M2
#---------------------------

# Moderate Sophistication:
ES_m2_com <- gam(eu ~ s(diseuself2) +  eco + aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_m2_com)


# High Sophistication:
ES_h2_com <- gam(eu ~ s(lr_intervention2) + eco + aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_h2_com)

#----------------------------------------------
# Distance between nation and self-placement:
#----------------------------------------------
ES_2_Rdis <- gam(eu ~ s(disnatself) + eco + aged + gender + pop + interest + undeveloped, data=ES)
summary(ES_2_Rdis)


#################
# Sweden (SE)
##################

#---------------------------
# Commission: based on M2
#---------------------------

# Moderate Sophistication:
SE_m2_com <- gam(eu ~ s(diseuself2) +  eco + aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_m2_com)


# High Sophistication:
SE_h2_com <- gam(eu ~ s(lr_intervention2) + eco + aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_h2_com)

#----------------------------------------------
# Distance between nation and self-placement:
#----------------------------------------------
SE_2_Rdis <- gam(eu ~ s(disnatself) + eco + aged + gender + pop + interest + undeveloped, data=SE)
summary(SE_2_Rdis)


#################
# Czech Republic (CZ)
##################

#---------------------------
# Commission: based on M2
#---------------------------

# Moderate Sophistication:
CZ_m2_com <- gam(eu ~ s(diseuself2) +  eco + aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_m2_com)


# High Sophistication:
CZ_h2_com <- gam(eu ~ s(lr_intervention2) + eco + aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_h2_com)

#----------------------------------------------
# Distance between nation and self-placement:
#----------------------------------------------
CZ_2_Rdis <- gam(eu ~ s(disnatself) + eco + aged + gender + pop + interest + undeveloped, data=CZ)
summary(CZ_2_Rdis)


#################
# Poland (PL)
##################

#---------------------------
# Commission: based on M2
#---------------------------

# Moderate Sophistication:
PL_m2_com <- gam(eu ~ s(diseuself2) +  eco + aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_m2_com)


# High Sophistication:
PL_h2_com <- gam(eu ~ s(lr_intervention2) + eco + aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_h2_com)

#----------------------------------------------
# Distance between nation and self-placement:
#----------------------------------------------
PL_2_Rdis <- gam(eu ~ s(disnatself) + eco + aged + gender + pop + interest + undeveloped, data=PL)
summary(PL_2_Rdis)


#-----------------------------------------------------------------------
# Table 6: Summary of Effects, Model Fit and Further Robustness Checks
#-----------------------------------------------------------------------

#---------------------------------------------
# (a) Summary of Effects and Model Fit (M2) 
#---------------------------------------------
Table6a <- matrix(NA, 12, ncol = 9)
colnames(Table6a) <- rep(c("Ideo.", "Econ.", "Dev."), times=3)
rownames(Table6a) <- c("Belgium","France", "Italy","Netherlands","Germany","UK","Greece","Portugal",
                       "Spain","Sweden","Czech Republic","Poland")

# low
Table6a[,3] <- round(c((summary(BE_l2)$dev.expl)*100, 
                       (summary(FR_l2)$dev.expl)*100, 
                       (summary(IT_l2)$dev.expl)*100, 
                       (summary(NL_l2)$dev.expl)*100, 
                       (summary(DE_l2)$dev.expl)*100, 
                       (summary(UK_l2)$dev.expl)*100, 
                       (summary(GR_l2)$dev.expl)*100, 
                       (summary(PT_l2)$dev.expl)*100, 
                       (summary(ES_l2)$dev.expl)*100, 
                       (summary(SE_l2)$dev.expl)*100,
                       (summary(CZ_l2)$dev.expl)*100, 
                       (summary(PL_l2)$dev.expl)*100), digits=2)

# moderate
Table6a[,6] <- round(c((summary(BE_m2)$dev.expl)*100, 
                       (summary(FR_m2)$dev.expl)*100, 
                       (summary(IT_m2)$dev.expl)*100, 
                       (summary(NL_m2)$dev.expl)*100, 
                       (summary(DE_m2)$dev.expl)*100, 
                       (summary(UK_m2)$dev.expl)*100, 
                       (summary(GR_m2)$dev.expl)*100, 
                       (summary(PT_m2)$dev.expl)*100, 
                       (summary(ES_m2)$dev.expl)*100, 
                       (summary(SE_m2)$dev.expl)*100,
                       (summary(CZ_m2)$dev.expl)*100, 
                       (summary(PL_m2)$dev.expl)*100), digits=2)

# high
Table6a[,9] <- round(c((summary(BE_h2)$dev.expl)*100, 
                       (summary(FR_h2)$dev.expl)*100, 
                       (summary(IT_h2)$dev.expl)*100, 
                       (summary(NL_h2)$dev.expl)*100, 
                       (summary(DE_h2)$dev.expl)*100, 
                       (summary(UK_h2)$dev.expl)*100, 
                       (summary(GR_h2)$dev.expl)*100, 
                       (summary(PT_h2)$dev.expl)*100, 
                       (summary(ES_h2)$dev.expl)*100, 
                       (summary(SE_h2)$dev.expl)*100,
                       (summary(CZ_h2)$dev.expl)*100, 
                       (summary(PL_h2)$dev.expl)*100), digits=2)

Table6a


#-----------------------------------------------------------------------------------
# (b) Measuring EU Policies by Governing Parties in the European Commission (M2)
#-----------------------------------------------------------------------------------
Table6b <- matrix(NA, 12, ncol = 9)
colnames(Table6b) <- rep(c("Ideo.", "Econ.", "Dev."), times=3)
rownames(Table6b) <- c("Belgium","France", "Italy","Netherlands","Germany","UK","Greece","Portugal",
                       "Spain","Sweden","Czech Republic","Poland")

# moderate
Table6b[,6] <- round(c((summary(BE_m2_com)$dev.expl)*100, 
                       (summary(FR_m2_com)$dev.expl)*100, 
                       (summary(IT_m2_com)$dev.expl)*100, 
                       (summary(NL_m2_com)$dev.expl)*100, 
                       (summary(DE_m2_com)$dev.expl)*100, 
                       (summary(UK_m2_com)$dev.expl)*100, 
                       (summary(GR_m2_com)$dev.expl)*100, 
                       (summary(PT_m2_com)$dev.expl)*100, 
                       (summary(ES_m2_com)$dev.expl)*100, 
                       (summary(SE_m2_com)$dev.expl)*100,
                       (summary(CZ_m2_com)$dev.expl)*100, 
                       (summary(PL_m2_com)$dev.expl)*100), digits=2)

# high
Table6b[,9] <- round(c((summary(BE_h2_com)$dev.expl)*100, 
                       (summary(FR_h2_com)$dev.expl)*100, 
                       (summary(IT_h2_com)$dev.expl)*100, 
                       (summary(NL_h2_com)$dev.expl)*100, 
                       (summary(DE_h2_com)$dev.expl)*100, 
                       0, 
                       0, 
                       (summary(PT_h2_com)$dev.expl)*100, 
                       (summary(ES_h2_com)$dev.expl)*100, 
                       (summary(SE_h2_com)$dev.expl)*100,
                       (summary(CZ_h2_com)$dev.expl)*100, 
                       (summary(PL_h2_com)$dev.expl)*100), digits=2)

Table6b


#------------------------------------------
# (c) Model with ideoi = |xi - xin| (M2)
#------------------------------------------
Table6c <- matrix(NA, 12, ncol = 3)
colnames(Table6c) <- c("Ideo.", "Econ.", "Dev.")
rownames(Table6c) <- c("Belgium","France", "Italy","Netherlands","Germany","UK","Greece","Portugal",
                       "Spain","Sweden","Czech Republic","Poland")

Table6c[,3] <- round(c((summary(BE_2_Rdis)$dev.expl)*100, 
                       (summary(FR_2_Rdis)$dev.expl)*100, 
                       (summary(IT_2_Rdis)$dev.expl)*100, 
                       (summary(NL_2_Rdis)$dev.expl)*100, 
                       (summary(DE_2_Rdis)$dev.expl)*100, 
                       (summary(UK_2_Rdis)$dev.expl)*100, 
                       (summary(GR_2_Rdis)$dev.expl)*100, 
                       (summary(PT_2_Rdis)$dev.expl)*100, 
                       (summary(ES_2_Rdis)$dev.expl)*100, 
                       (summary(SE_2_Rdis)$dev.expl)*100,
                       (summary(CZ_2_Rdis)$dev.expl)*100, 
                       (summary(PL_2_Rdis)$dev.expl)*100), digits=2)

Table6c


########################################################################################


#######################
# Online Appendix: 
#######################

#+++++++++++++++++++++++++++++++++++++++
# B Details on Data and Variables
#+++++++++++++++++++++++++++++++++++++++

#------------------------------------------------------------------
# Table A3: Proportions of Multicategorical Control Variables
#------------------------------------------------------------------

TableA3 <- matrix(NA, 12, ncol = 7)
colnames(TableA3) <- c("rural", "small or middle-sized", "large town", 
                       "not at all", "little", "somewhat", "very")
rownames(TableA3) <- c("Belgium","France", "Italy","Netherlands","Germany","UK","Greece","Portugal",
                       "Spain","Sweden","Czech Republic","Poland")


# BE
TableA3[1,] <- c(round(prop.table(table(BE$pop))[1], digits=2), 
                 round(prop.table(table(BE$pop))[2], digits=2),
                 round(prop.table(table(BE$pop))[3], digits=2),
                 round(prop.table(table(BE$interest))[1], digits=2),  
                 round(prop.table(table(BE$interest))[2], digits=2),  
                 round(prop.table(table(BE$interest))[3], digits=2),  
                 round(prop.table(table(BE$interest))[4], digits=2))
# FR
TableA3[2,] <- c(round(prop.table(table(FR$pop))[1], digits=2), 
                 round(prop.table(table(FR$pop))[2], digits=2),
                 round(prop.table(table(FR$pop))[3], digits=2),
                 round(prop.table(table(FR$interest))[1], digits=2),  
                 round(prop.table(table(FR$interest))[2], digits=2),  
                 round(prop.table(table(FR$interest))[3], digits=2),  
                 round(prop.table(table(FR$interest))[4], digits=2))                      
# IT
TableA3[3,] <- c(round(prop.table(table(IT$pop))[1], digits=2), 
                 round(prop.table(table(IT$pop))[2], digits=2),
                 round(prop.table(table(IT$pop))[3], digits=2),
                 round(prop.table(table(IT$interest))[1], digits=2),  
                 round(prop.table(table(IT$interest))[2], digits=2),  
                 round(prop.table(table(IT$interest))[3], digits=2),  
                 round(prop.table(table(IT$interest))[4], digits=2))     
# NL
TableA3[4,] <- c(round(prop.table(table(NL$pop))[1], digits=2), 
                 round(prop.table(table(NL$pop))[2], digits=2),
                 round(prop.table(table(NL$pop))[3], digits=2),
                 round(prop.table(table(NL$interest))[1], digits=2),  
                 round(prop.table(table(NL$interest))[2], digits=2),  
                 round(prop.table(table(NL$interest))[3], digits=2),  
                 round(prop.table(table(NL$interest))[4], digits=2))
# DE
TableA3[5,] <- c(round(prop.table(table(DE$pop))[1], digits=2), 
                 round(prop.table(table(DE$pop))[2], digits=2),
                 round(prop.table(table(DE$pop))[3], digits=2),
                 round(prop.table(table(DE$interest))[1], digits=2),  
                 round(prop.table(table(DE$interest))[2], digits=2),  
                 round(prop.table(table(DE$interest))[3], digits=2),  
                 round(prop.table(table(DE$interest))[4], digits=2))
# UK
TableA3[6,] <- c(round(prop.table(table(UK$pop))[1], digits=2), 
                 round(prop.table(table(UK$pop))[2], digits=2),
                 round(prop.table(table(UK$pop))[3], digits=2),
                 round(prop.table(table(UK$interest))[1], digits=2),  
                 round(prop.table(table(UK$interest))[2], digits=2),  
                 round(prop.table(table(UK$interest))[3], digits=2),  
                 round(prop.table(table(UK$interest))[4], digits=2))
# GR
TableA3[7,] <- c(round(prop.table(table(GR$pop))[1], digits=2), 
                 round(prop.table(table(GR$pop))[2], digits=2),
                 round(prop.table(table(GR$pop))[3], digits=2),
                 round(prop.table(table(GR$interest))[1], digits=2),  
                 round(prop.table(table(GR$interest))[2], digits=2),  
                 round(prop.table(table(GR$interest))[3], digits=2),  
                 round(prop.table(table(GR$interest))[4], digits=2))
# PT
TableA3[8,] <- c(round(prop.table(table(PT$pop))[1], digits=2), 
                 round(prop.table(table(PT$pop))[2], digits=2),
                 round(prop.table(table(PT$pop))[3], digits=2),
                 round(prop.table(table(PT$interest))[1], digits=2),  
                 round(prop.table(table(PT$interest))[2], digits=2),  
                 round(prop.table(table(PT$interest))[3], digits=2),  
                 round(prop.table(table(PT$interest))[4], digits=2))
# ES
TableA3[9,] <- c(round(prop.table(table(ES$pop))[1], digits=2), 
                 round(prop.table(table(ES$pop))[2], digits=2),
                 round(prop.table(table(ES$pop))[3], digits=2),
                 round(prop.table(table(ES$interest))[1], digits=2),  
                 round(prop.table(table(ES$interest))[2], digits=2),  
                 round(prop.table(table(ES$interest))[3], digits=2),  
                 round(prop.table(table(ES$interest))[4], digits=2))
# SE
TableA3[10,] <- c(round(prop.table(table(SE$pop))[1], digits=2), 
                  round(prop.table(table(SE$pop))[2], digits=2),
                  round(prop.table(table(SE$pop))[3], digits=2),
                  round(prop.table(table(SE$interest))[1], digits=2),  
                  round(prop.table(table(SE$interest))[2], digits=2),  
                  round(prop.table(table(SE$interest))[3], digits=2),  
                  round(prop.table(table(SE$interest))[4], digits=2))
# CZ
TableA3[11,] <- c(round(prop.table(table(CZ$pop))[1], digits=2), 
                  round(prop.table(table(CZ$pop))[2], digits=2),
                  round(prop.table(table(CZ$pop))[3], digits=2),
                  round(prop.table(table(CZ$interest))[1], digits=2),  
                  round(prop.table(table(CZ$interest))[2], digits=2),  
                  round(prop.table(table(CZ$interest))[3], digits=2),  
                  round(prop.table(table(CZ$interest))[4], digits=2))
# PL
TableA3[12,] <- c(round(prop.table(table(PL$pop))[1], digits=2), 
                  round(prop.table(table(PL$pop))[2], digits=2),
                  round(prop.table(table(PL$pop))[3], digits=2),
                  round(prop.table(table(PL$interest))[1], digits=2),  
                  round(prop.table(table(PL$interest))[2], digits=2),  
                  round(prop.table(table(PL$interest))[3], digits=2),  
                  round(prop.table(table(PL$interest))[4], digits=2))

TableA3


#------------------------------------------------------------------
# Table A4: Measures of Correlation and Association between Economic 
#           Status, Education Level and Interest in Politics
#------------------------------------------------------------------

TableA4 <- matrix(NA, 12, ncol = 3)
colnames(TableA4) <- c("Cor(eco, educ)", "Cor(educ, interest)", "Kendall(educ, interest)")
rownames(TableA4) <- c("Belgium","France", "Italy","Netherlands","Germany","UK","Greece","Portugal",
                       "Spain","Sweden","Czech Republic","Poland")


# BE
TableA4[1,] <- c(round(cor(BE$eco, BE$educ), digits=2), 
                 round(cor(as.numeric(BE$educ), as.numeric(BE$interest)), digits=2),
                 round(cor(as.numeric(BE$educ), as.numeric(BE$interest), method="kendall"), digits=2))
# FR
TableA4[2,] <- c(round(cor(FR$eco, FR$educ), digits=2), 
                 round(cor(as.numeric(FR$educ), as.numeric(FR$interest)), digits=2),
                 round(cor(as.numeric(FR$educ), as.numeric(FR$interest), method="kendall"), digits=2))
# IT                 
TableA4[3,] <- c(round(cor(IT$eco, IT$educ), digits=2), 
                 round(cor(as.numeric(IT$educ), as.numeric(IT$interest)), digits=2),
                 round(cor(as.numeric(IT$educ), as.numeric(IT$interest), method="kendall"), digits=2))
# NL                
TableA4[4,] <- c(round(cor(NL$eco, NL$educ), digits=2), 
                 round(cor(as.numeric(NL$educ), as.numeric(NL$interest)), digits=2),
                 round(cor(as.numeric(NL$educ), as.numeric(NL$interest), method="kendall"), digits=2))
# DE                 
TableA4[5,] <- c(round(cor(DE$eco, DE$educ), digits=2), 
                 round(cor(as.numeric(DE$educ), as.numeric(DE$interest)), digits=2),
                 round(cor(as.numeric(DE$educ), as.numeric(DE$interest), method="kendall"), digits=2))
# UK                
TableA4[6,] <- c(round(cor(UK$eco, UK$educ), digits=2), 
                 round(cor(as.numeric(UK$educ), as.numeric(UK$interest)), digits=2),
                 round(cor(as.numeric(UK$educ), as.numeric(UK$interest), method="kendall"), digits=2))
# GR
TableA4[7,] <- c(round(cor(GR$eco, GR$educ), digits=2), 
                 round(cor(as.numeric(GR$educ), as.numeric(GR$interest)), digits=2),
                 round(cor(as.numeric(GR$educ), as.numeric(GR$interest), method="kendall"), digits=2))
# PT
TableA4[8,] <- c(round(cor(PT$eco, PT$educ), digits=2), 
                 round(cor(as.numeric(PT$educ), as.numeric(PT$interest)), digits=2),
                 round(cor(as.numeric(PT$educ), as.numeric(PT$interest), method="kendall"), digits=2))
# ES
TableA4[9,] <- c(round(cor(ES$eco, ES$educ), digits=2), 
                 round(cor(as.numeric(ES$educ), as.numeric(ES$interest)), digits=2),
                 round(cor(as.numeric(ES$educ), as.numeric(ES$interest), method="kendall"), digits=2))
# SE
TableA4[10,] <- c(round(cor(SE$eco, SE$educ), digits=2), 
                  round(cor(as.numeric(SE$educ), as.numeric(SE$interest)), digits=2),
                  round(cor(as.numeric(SE$educ), as.numeric(SE$interest), method="kendall"), digits=2))
# CZ
TableA4[11,] <- c(round(cor(CZ$eco, CZ$educ), digits=2), 
                  round(cor(as.numeric(CZ$educ), as.numeric(CZ$interest)), digits=2),
                  round(cor(as.numeric(CZ$educ), as.numeric(CZ$interest), method="kendall"), digits=2))
# PL                 
TableA4[12,] <- c(round(cor(PL$eco, PL$educ), digits=2), 
                  round(cor(as.numeric(PL$educ), as.numeric(PL$interest)), digits=2),
                  round(cor(as.numeric(PL$educ), as.numeric(PL$interest), method="kendall"), digits=2))

TableA4

#+++++++++++++++++++++++++++++++++++++++
# C Testing for Interaction Effects
#+++++++++++++++++++++++++++++++++++++++

#------------------------------------------------------------------------
# Table A5: Testing for Interactions: Founding Member States
#------------------------------------------------------------------------

TableA5 <- matrix(NA, 25, ncol = 3)
colnames(TableA5) <- c("Low", "Moderate", "High")
rownames(TableA5) <- c("Belgium: M2: Controls + ideo + eco",
                       "M2 + int(ideo, eco)", 
                       "M2 + int(ideo, interest)", 
                       "M3: Controls + ideo + education",
                       "M3 + int(ideo, education)",
                       "France: M2: Controls + ideo + eco",
                       "M2 + int(ideo, eco)", 
                       "M2 + int(ideo, interest)", 
                       "M3: Controls + ideo + education",
                       "M3 + int(ideo, education)",
                       "Italy: M2: Controls + ideo + eco",
                       "M2 + int(ideo, eco)", 
                       "M2 + int(ideo, interest)", 
                       "M3: Controls + ideo + education",
                       "M3 + int(ideo, education)",
                       "Netherlands: M2: Controls + ideo + eco",
                       "M2 + int(ideo, eco)", 
                       "M2 + int(ideo, interest)", 
                       "M3: Controls + ideo + education",
                       "M3 + int(ideo, education)",
                       "Germany: M2: Controls + ideo + eco",
                       "M2 + int(ideo, eco)", 
                       "M2 + int(ideo, interest)", 
                       "M3: Controls + ideo + education",
                       "M3 + int(ideo, education)")

TableA5[,1] <- round(c(BIC(BE_l2), BIC(BE_l2int1), BIC(BE_l2int2), BIC(BE_l3), BIC(BE_l3int3),
                       BIC(FR_l2), BIC(FR_l2int1), BIC(FR_l2int2), BIC(FR_l3), BIC(FR_l3int3),
                       BIC(IT_l2), BIC(IT_l2int1), BIC(IT_l2int2), BIC(IT_l3), BIC(IT_l3int3),
                       BIC(NL_l2), BIC(NL_l2int1), BIC(NL_l2int2), BIC(NL_l3), BIC(NL_l3int3),
                       BIC(DE_l2), BIC(DE_l2int1), BIC(DE_l2int2), BIC(DE_l3), BIC(DE_l3int3)), digits=2)

TableA5[,2] <- round(c(BIC(BE_m2), BIC(BE_m2int1), BIC(BE_m2int2), BIC(BE_m3), BIC(BE_m3int3),
                       BIC(FR_m2), BIC(FR_m2int1), BIC(FR_m2int2), BIC(FR_m3), BIC(FR_m3int3),
                       BIC(IT_m2), BIC(IT_m2int1), BIC(IT_m2int2), BIC(IT_m3), BIC(IT_m3int3),
                       BIC(NL_m2), BIC(NL_m2int1), BIC(NL_m2int2), BIC(NL_m3), BIC(NL_m3int3),
                       BIC(DE_m2), BIC(DE_m2int1), BIC(DE_m2int2), BIC(DE_m3), BIC(DE_m3int3)), digits=2)

TableA5[,3] <- round(c(BIC(BE_h2), BIC(BE_h2int1), BIC(BE_h2int2), BIC(BE_h3), BIC(BE_h3int3),
                       BIC(FR_h2), BIC(FR_h2int1), BIC(FR_h2int2), BIC(FR_h3), BIC(FR_h3int3),
                       BIC(IT_h2), BIC(IT_h2int1), BIC(IT_h2int2), BIC(IT_h3), BIC(IT_h3int3),
                       BIC(NL_h2), BIC(NL_h2int1), BIC(NL_h2int2), BIC(NL_h3), BIC(NL_h3int3),
                       BIC(DE_h2), BIC(DE_h2int1), BIC(DE_h2int2), BIC(DE_h3), BIC(DE_h3int3)), digits=2)

TableA5


#-----------------------------------------------------------------------------
# Table A6: Testing for Interactions: Non-Founding Member States
#-----------------------------------------------------------------------------

TableA6 <- matrix(NA, 35, ncol = 3)
colnames(TableA6) <- c("Low", "Moderate", "High")
rownames(TableA6) <- c("UK: M2: Controls + ideo + eco",
                       "M2 + int(ideo, eco)", 
                       "M2 + int(ideo, interest)", 
                       "M3: Controls + ideo + education",
                       "M3 + int(ideo, education)",
                       "Greece: M2: Controls + ideo + eco",
                       "M2 + int(ideo, eco)", 
                       "M2 + int(ideo, interest)", 
                       "M3: Controls + ideo + education",
                       "M3 + int(ideo, education)",
                       "Portugal: M2: Controls + ideo + eco",
                       "M2 + int(ideo, eco)", 
                       "M2 + int(ideo, interest)", 
                       "M3: Controls + ideo + education",
                       "M3 + int(ideo, education)",
                       "Spain: M2: Controls + ideo + eco",
                       "M2 + int(ideo, eco)", 
                       "M2 + int(ideo, interest)", 
                       "M3: Controls + ideo + education",
                       "M3 + int(ideo, education)",
                       "Sweden: M2: Controls + ideo + eco",
                       "M2 + int(ideo, eco)", 
                       "M2 + int(ideo, interest)", 
                       "M3: Controls + ideo + education",
                       "M3 + int(ideo, education)",
                       "Czech Republic: M2: Controls + ideo + eco",
                       "M2 + int(ideo, eco)", 
                       "M2 + int(ideo, interest)", 
                       "M3: Controls + ideo + education",
                       "M3 + int(ideo, education)",
                       "Poland: M2: Controls + ideo + eco",
                       "M2 + int(ideo, eco)", 
                       "M2 + int(ideo, interest)", 
                       "M3: Controls + ideo + education",
                       "M3 + int(ideo, education)")

TableA6[,1] <- round(c(BIC(UK_l2), BIC(UK_l2int1), BIC(UK_l2int2), BIC(UK_l3), BIC(UK_l3int3),
                       BIC(GR_l2), BIC(GR_l2int1), BIC(GR_l2int2), BIC(GR_l3), BIC(GR_l3int3),
                       BIC(PT_l2), BIC(PT_l2int1), BIC(PT_l2int2), BIC(PT_l3), BIC(PT_l3int3),
                       BIC(ES_l2), BIC(ES_l2int1), BIC(ES_l2int2), BIC(ES_l3), BIC(ES_l3int3),
                       BIC(SE_l2), BIC(SE_l2int1), BIC(SE_l2int2), BIC(SE_l3), BIC(SE_l3int3),
                       BIC(CZ_l2), BIC(CZ_l2int1), BIC(CZ_l2int2), BIC(CZ_l3), BIC(CZ_l3int3),
                       BIC(PL_l2), BIC(PL_l2int1), BIC(PL_l2int2), BIC(PL_l3), BIC(PL_l3int3)), digits=2)

TableA6[,2] <- round(c(BIC(UK_m2), BIC(UK_m2int1), BIC(UK_m2int2), BIC(UK_m3), BIC(UK_m3int3),
                       BIC(GR_m2), BIC(GR_m2int1), BIC(GR_m2int2), BIC(GR_m3), BIC(GR_m3int3),
                       BIC(PT_m2), BIC(PT_m2int1), BIC(PT_m2int2), BIC(PT_m3), BIC(PT_m3int3),
                       BIC(ES_m2), BIC(ES_m2int1), BIC(ES_m2int2), BIC(ES_m3), BIC(ES_m3int3),
                       BIC(SE_m2), BIC(SE_m2int1), BIC(SE_m2int2), BIC(SE_m3), BIC(SE_m3int3),
                       BIC(CZ_m2), BIC(CZ_m2int1), BIC(CZ_m2int2), BIC(CZ_m3), BIC(CZ_m3int3),
                       BIC(PL_m2), BIC(PL_m2int1), BIC(PL_m2int2), BIC(PL_m3), BIC(PL_m3int3)), digits=2)

TableA6[,3] <- round(c(BIC(UK_h2), BIC(UK_h2int1), BIC(UK_h2int2), BIC(UK_h3), BIC(UK_h3int3),
                       BIC(GR_h2), BIC(GR_h2int1), BIC(GR_h2int2), BIC(GR_h3), BIC(GR_h3int3),
                       BIC(PT_h2), BIC(PT_h2int1), BIC(PT_h2int2), BIC(PT_h3), BIC(PT_h3int3),
                       BIC(ES_h2), BIC(ES_h2int1), BIC(ES_h2int2), BIC(ES_h3), BIC(ES_h3int3),
                       BIC(SE_h2), BIC(SE_h2int1), BIC(SE_h2int2), BIC(SE_h3), BIC(SE_h3int3),
                       BIC(CZ_h2), BIC(CZ_h2int1), BIC(CZ_h2int2), BIC(CZ_h3), BIC(CZ_h3int3),
                       BIC(PL_h2), BIC(PL_h2int1), BIC(PL_h2int2), BIC(PL_h3), BIC(PL_h3int3)), digits=2)

TableA6


#+++++++++++++++++++++++++++++++++++++++
# D Estimation Tables for M2
#+++++++++++++++++++++++++++++++++++++++

#-----------------------------------------------------------------------------
# Table A7: M2: Approximate Significance of Smooth Terms for Ideological Effects
#-----------------------------------------------------------------------------
TableA7 <- matrix(NA, 12 , ncol = 9)
colnames(TableA7) <- rep(c("edf", "F Statistic", "p-value"), times=3)
rownames(TableA7) <- c("Belgium","France","Italy","Netherlands",
                       "Germany","UK","Greece","Portugal",
                       "Spain","Sweden","Czech Republic","Poland")

# low
# edf
TableA7[,1] <- round(c(summary(BE_l2)$s.table[1], 
                       summary(FR_l2)$s.table[1], 
                       summary(IT_l2)$s.table[1], 
                       summary(NL_l2)$s.table[1], 
                       summary(DE_l2)$s.table[1], 
                       summary(UK_l2)$s.table[1], 
                       summary(GR_l2)$s.table[1], 
                       summary(PT_l2)$s.table[1], 
                       summary(ES_l2)$s.table[1], 
                       summary(SE_l2)$s.table[1],
                       summary(CZ_l2)$s.table[1], 
                       summary(PL_l2)$s.table[1]), digits=2)

# F-Statistic
TableA7[,2] <- round(c(summary(BE_l2)$s.table[3], 
                       summary(FR_l2)$s.table[3], 
                       summary(IT_l2)$s.table[3], 
                       summary(NL_l2)$s.table[3], 
                       summary(DE_l2)$s.table[3], 
                       summary(UK_l2)$s.table[3], 
                       summary(GR_l2)$s.table[3], 
                       summary(PT_l2)$s.table[3], 
                       summary(ES_l2)$s.table[3], 
                       summary(SE_l2)$s.table[3],
                       summary(CZ_l2)$s.table[3], 
                       summary(PL_l2)$s.table[3]), digits=2)

# p-value
TableA7[,3] <- round(c(summary(BE_l2)$s.table[4], 
                       summary(FR_l2)$s.table[4], 
                       summary(IT_l2)$s.table[4], 
                       summary(NL_l2)$s.table[4], 
                       summary(DE_l2)$s.table[4], 
                       summary(UK_l2)$s.table[4], 
                       summary(GR_l2)$s.table[4], 
                       summary(PT_l2)$s.table[4], 
                       summary(ES_l2)$s.table[4], 
                       summary(SE_l2)$s.table[4],
                       summary(CZ_l2)$s.table[4], 
                       summary(PL_l2)$s.table[4]), digits=2)


# moderate
# edf
TableA7[,4] <- round(c(summary(BE_m2)$s.table[1], 
                       summary(FR_m2)$s.table[1], 
                       summary(IT_m2)$s.table[1], 
                       summary(NL_m2)$s.table[1], 
                       summary(DE_m2)$s.table[1], 
                       summary(UK_m2)$s.table[1], 
                       summary(GR_m2)$s.table[1], 
                       summary(PT_m2)$s.table[1], 
                       summary(ES_m2)$s.table[1], 
                       summary(SE_m2)$s.table[1],
                       summary(CZ_m2)$s.table[1], 
                       summary(PL_m2)$s.table[1]), digits=2)

# F-Statistic
TableA7[,5] <- round(c(summary(BE_m2)$s.table[3], 
                       summary(FR_m2)$s.table[3], 
                       summary(IT_m2)$s.table[3], 
                       summary(NL_m2)$s.table[3], 
                       summary(DE_m2)$s.table[3], 
                       summary(UK_m2)$s.table[3], 
                       summary(GR_m2)$s.table[3], 
                       summary(PT_m2)$s.table[3], 
                       summary(ES_m2)$s.table[3], 
                       summary(SE_m2)$s.table[3],
                       summary(CZ_m2)$s.table[3], 
                       summary(PL_m2)$s.table[3]), digits=2)

# p-value
TableA7[,6] <- round(c(summary(BE_m2)$s.table[4], 
                       summary(FR_m2)$s.table[4], 
                       summary(IT_m2)$s.table[4], 
                       summary(NL_m2)$s.table[4], 
                       summary(DE_m2)$s.table[4], 
                       summary(UK_m2)$s.table[4], 
                       summary(GR_m2)$s.table[4], 
                       summary(PT_m2)$s.table[4], 
                       summary(ES_m2)$s.table[4], 
                       summary(SE_m2)$s.table[4],
                       summary(CZ_m2)$s.table[4], 
                       summary(PL_m2)$s.table[4]), digits=2)

# high
# edf
TableA7[,7] <- round(c(summary(BE_h2)$s.table[1], 
                       summary(FR_h2)$s.table[1], 
                       summary(IT_h2)$s.table[1], 
                       summary(NL_h2)$s.table[1], 
                       summary(DE_h2)$s.table[1], 
                       summary(UK_h2)$s.table[1], 
                       summary(GR_h2)$s.table[1], 
                       summary(PT_h2)$s.table[1], 
                       summary(ES_h2)$s.table[1], 
                       summary(SE_h2)$s.table[1],
                       summary(CZ_h2)$s.table[1], 
                       summary(PL_h2)$s.table[1]), digits=2)

# F-Statistic
TableA7[,8] <- round(c(summary(BE_h2)$s.table[3], 
                       summary(FR_h2)$s.table[3], 
                       summary(IT_h2)$s.table[3], 
                       summary(NL_h2)$s.table[3], 
                       summary(DE_h2)$s.table[3], 
                       summary(UK_h2)$s.table[3], 
                       summary(GR_h2)$s.table[3], 
                       summary(PT_h2)$s.table[3], 
                       summary(ES_h2)$s.table[3], 
                       summary(SE_h2)$s.table[3],
                       summary(CZ_h2)$s.table[3], 
                       summary(PL_h2)$s.table[3]), digits=2)

# p-value
TableA7[,9] <- round(c(summary(BE_h2)$s.table[4], 
                       summary(FR_h2)$s.table[4], 
                       summary(IT_h2)$s.table[4], 
                       summary(NL_h2)$s.table[4], 
                       summary(DE_h2)$s.table[4], 
                       summary(UK_h2)$s.table[4], 
                       summary(GR_h2)$s.table[4], 
                       summary(PT_h2)$s.table[4], 
                       summary(ES_h2)$s.table[4], 
                       summary(SE_h2)$s.table[4],
                       summary(CZ_h2)$s.table[4], 
                       summary(PL_h2)$s.table[4]), digits=2)

TableA7


#--------------------------------------------------------------------------------------------------
# Table A8: M2 Parametric Coefficients for the Three Settings: Low, Moderate and High Sophistication 
#---------------------------------------------------------------------------------------------------

TableA8 <- matrix(NA, 120, ncol = 9)
colnames(TableA8) <- rep(c("coef.", "s.e.", "p-val."), times=3)
rownames(TableA8) <- rep(c( "Intercept", "Economic status", "Age", "Female", 
                            "Pop. size: small", "Pop. size: large", 
                            "Interest: little", "Interest: somewhat", "Interest: very", "Undeveloped"), times=12)

# BE
TableA8[1:10,1] <- round(BE_l2$coefficients[1:10], digits=2)
TableA8[1:10,2] <- round(summary(BE_l2)$se[1:10], digits=2)
TableA8[1:10,3] <- round(summary(BE_l2)$p.pv[1:10], digits=2)

TableA8[1:10,4] <- round(BE_m2$coefficients[1:10], digits=2)
TableA8[1:10,5] <- round(summary(BE_m2)$se[1:10], digits=2)
TableA8[1:10,6] <- round(summary(BE_m2)$p.pv[1:10], digits=2)
#
TableA8[1:10,7] <- round(BE_h2$coefficients[1:10], digits=2)
TableA8[1:10,8] <- round(summary(BE_h2)$se[1:10], digits=2)
TableA8[1:10,9] <- round(summary(BE_h2)$p.pv[1:10], digits=2)

# FR
TableA8[11:20,1] <- round(FR_l2$coefficients[1:10], digits=2)
TableA8[11:20,2] <- round(summary(FR_l2)$se[1:10], digits=2)
TableA8[11:20,3] <- round(summary(FR_l2)$p.pv[1:10], digits=2)
#
TableA8[11:20,4] <- round(FR_m2$coefficients[1:10], digits=2)
TableA8[11:20,5] <- round(summary(FR_m2)$se[1:10], digits=2)
TableA8[11:20,6] <- round(summary(FR_m2)$p.pv[1:10], digits=2)
#
TableA8[11:20,7] <- round(FR_h2$coefficients[1:10], digits=2)
TableA8[11:20,8] <- round(summary(FR_h2)$se[1:10], digits=2)
TableA8[11:20,9] <- round(summary(FR_h2)$p.pv[1:10], digits=2)

# IT
TableA8[21:30,1] <- round(IT_l2$coefficients[1:10], digits=2)
TableA8[21:30,2] <- round(summary(IT_l2)$se[1:10], digits=2)
TableA8[21:30,3] <- round(summary(IT_l2)$p.pv[1:10], digits=2)
#
TableA8[21:30,4] <- round(IT_m2$coefficients[1:10], digits=2)
TableA8[21:30,5] <- round(summary(IT_m2)$se[1:10], digits=2)
TableA8[21:30,6] <- round(summary(IT_m2)$p.pv[1:10], digits=2)
#
TableA8[21:30,7] <- round(IT_h2$coefficients[1:10], digits=2)
TableA8[21:30,8] <- round(summary(IT_h2)$se[1:10], digits=2)
TableA8[21:30,9] <- round(summary(IT_h2)$p.pv[1:10], digits=2)

# NL
TableA8[31:40,1] <- round(NL_l2$coefficients[1:10], digits=2)
TableA8[31:40,2] <- round(summary(NL_l2)$se[1:10], digits=2)
TableA8[31:40,3] <- round(summary(NL_l2)$p.pv[1:10], digits=2)
#
TableA8[31:40,4] <- round(NL_m2$coefficients[1:10], digits=2)
TableA8[31:40,5] <- round(summary(NL_m2)$se[1:10], digits=2)
TableA8[31:40,6] <- round(summary(NL_m2)$p.pv[1:10], digits=2)
#
TableA8[31:40,7] <- round(NL_h2$coefficients[1:10], digits=2)
TableA8[31:40,8] <- round(summary(NL_h2)$se[1:10], digits=2)
TableA8[31:40,9] <- round(summary(NL_h2)$p.pv[1:10], digits=2)

# DE
TableA8[41:50,1] <- round(DE_l2$coefficients[1:10], digits=2)
TableA8[41:50,2] <- round(summary(DE_l2)$se[1:10], digits=2)
TableA8[41:50,3] <- round(summary(DE_l2)$p.pv[1:10], digits=2)
#
TableA8[41:50,4] <- round(DE_m2$coefficients[1:10], digits=2)
TableA8[41:50,5] <- round(summary(DE_m2)$se[1:10], digits=2)
TableA8[41:50,6] <- round(summary(DE_m2)$p.pv[1:10], digits=2)
#
TableA8[41:50,7] <- round(DE_h2$coefficients[1:10], digits=2)
TableA8[41:50,8] <- round(summary(DE_h2)$se[1:10], digits=2)
TableA8[41:50,9] <- round(summary(DE_h2)$p.pv[1:10], digits=2)

# UK
TableA8[51:60,1] <- round(UK_l2$coefficients[1:10], digits=2)
TableA8[51:60,2] <- round(summary(UK_l2)$se[1:10], digits=2)
TableA8[51:60,3] <- round(summary(UK_l2)$p.pv[1:10], digits=2)
#
TableA8[51:60,4] <- round(UK_m2$coefficients[1:10], digits=2)
TableA8[51:60,5] <- round(summary(UK_m2)$se[1:10], digits=2)
TableA8[51:60,6] <- round(summary(UK_m2)$p.pv[1:10], digits=2)
#
TableA8[51:60,7] <- round(UK_h2$coefficients[1:10], digits=2)
TableA8[51:60,8] <- round(summary(UK_h2)$se[1:10], digits=2)
TableA8[51:60,9] <- round(summary(UK_h2)$p.pv[1:10], digits=2)

# GR
TableA8[61:70,1] <- round(GR_l2$coefficients[1:10], digits=2)
TableA8[61:70,2] <- round(summary(GR_l2)$se[1:10], digits=2)
TableA8[61:70,3] <- round(summary(GR_l2)$p.pv[1:10], digits=2)
#
TableA8[61:70,4] <- round(GR_m2$coefficients[1:10], digits=2)
TableA8[61:70,5] <- round(summary(GR_m2)$se[1:10], digits=2)
TableA8[61:70,6] <- round(summary(GR_m2)$p.pv[1:10], digits=2)
#
TableA8[61:70,7] <- round(GR_h2$coefficients[1:10], digits=2)
TableA8[61:70,8] <- round(summary(GR_h2)$se[1:10], digits=2)
TableA8[61:70,9] <- round(summary(GR_h2)$p.pv[1:10], digits=2)

# PT
TableA8[71:80,1] <- round(PT_l2$coefficients[1:10], digits=2)
TableA8[71:80,2] <- round(summary(PT_l2)$se[1:10], digits=2)
TableA8[71:80,3] <- round(summary(PT_l2)$p.pv[1:10], digits=2)
#
TableA8[71:80,4] <- round(PT_m2$coefficients[1:10], digits=2)
TableA8[71:80,5] <- round(summary(PT_m2)$se[1:10], digits=2)
TableA8[71:80,6] <- round(summary(PT_m2)$p.pv[1:10], digits=2)
#
TableA8[71:80,7] <- round(PT_h2$coefficients[1:10], digits=2)
TableA8[71:80,8] <- round(summary(PT_h2)$se[1:10], digits=2)
TableA8[71:80,9] <- round(summary(PT_h2)$p.pv[1:10], digits=2)

# ES
TableA8[81:90,1] <- round(ES_l2$coefficients[1:10], digits=2)
TableA8[81:90,2] <- round(summary(ES_l2)$se[1:10], digits=2)
TableA8[81:90,3] <- round(summary(ES_l2)$p.pv[1:10], digits=2)
#
TableA8[81:90,4] <- round(ES_m2$coefficients[1:10], digits=2)
TableA8[81:90,5] <- round(summary(ES_m2)$se[1:10], digits=2)
TableA8[81:90,6] <- round(summary(ES_m2)$p.pv[1:10], digits=2)
#
TableA8[81:90,7] <- round(ES_h2$coefficients[1:10], digits=2)
TableA8[81:90,8] <- round(summary(ES_h2)$se[1:10], digits=2)
TableA8[81:90,9] <- round(summary(ES_h2)$p.pv[1:10], digits=2)

# SE
TableA8[91:100,1] <- round(SE_l2$coefficients[1:10], digits=2)
TableA8[91:100,2] <- round(summary(SE_l2)$se[1:10], digits=2)
TableA8[91:100,3] <- round(summary(SE_l2)$p.pv[1:10], digits=2)
#
TableA8[91:100,4] <- round(SE_m2$coefficients[1:10], digits=2)
TableA8[91:100,5] <- round(summary(SE_m2)$se[1:10], digits=2)
TableA8[91:100,6] <- round(summary(SE_m2)$p.pv[1:10], digits=2)
#
TableA8[91:100,7] <- round(SE_h2$coefficients[1:10], digits=2)
TableA8[91:100,8] <- round(summary(SE_h2)$se[1:10], digits=2)
TableA8[91:100,9] <- round(summary(SE_h2)$p.pv[1:10], digits=2)

# CZ
TableA8[101:110,1] <- round(CZ_l2$coefficients[1:10], digits=2)
TableA8[101:110,2] <- round(summary(CZ_l2)$se[1:10], digits=2)
TableA8[101:110,3] <- round(summary(CZ_l2)$p.pv[1:10], digits=2)
#
TableA8[101:110,4] <- round(CZ_m2$coefficients[1:10], digits=2)
TableA8[101:110,5] <- round(summary(CZ_m2)$se[1:10], digits=2)
TableA8[101:110,6] <- round(summary(CZ_m2)$p.pv[1:10], digits=2)
#
TableA8[101:110,7] <- round(CZ_h2$coefficients[1:10], digits=2)
TableA8[101:110,8] <- round(summary(CZ_h2)$se[1:10], digits=2)
TableA8[101:110,9] <- round(summary(CZ_h2)$p.pv[1:10], digits=2)

# PL
TableA8[111:120,1] <- round(PL_l2$coefficients[1:10], digits=2)
TableA8[111:120,2] <- round(summary(PL_l2)$se[1:10], digits=2)
TableA8[111:120,3] <- round(summary(PL_l2)$p.pv[1:10], digits=2)
#
TableA8[111:120,4] <- round(PL_m2$coefficients[1:10], digits=2)
TableA8[111:120,5] <- round(summary(PL_m2)$se[1:10], digits=2)
TableA8[111:120,6] <- round(summary(PL_m2)$p.pv[1:10], digits=2)
#
TableA8[111:120,7] <- round(PL_h2$coefficients[1:10], digits=2)
TableA8[111:120,8] <- round(summary(PL_h2)$se[1:10], digits=2)
TableA8[111:120,9] <- round(summary(PL_h2)$p.pv[1:10], digits=2)

TableA8



#+++++++++++++++++++++++++++++++++++++++
# E Robustness Checks
#+++++++++++++++++++++++++++++++++++++++


###############################################################
# E.1 M3: Using Education Level instead of Economic Status
################################################################

#-------------------------------------------------------------------------------
# Table A9: M3: Ideological Effects s(ideo_i) and Educational Effects education_i
#--------------------------------------------------------------------------------

TableA9 <- matrix(NA, 12 , ncol = 6)
colnames(TableA9) <- rep(c("edf", "educ: coef"), times=3)
rownames(TableA9) <- c("Belgium","France","Italy","Netherlands",
                       "Germany","UK","Greece","Portugal",
                       "Spain","Sweden","Czech Republic","Poland")

# Low sophistication
# edf
TableA9[,1] <- round(c(summary(BE_l3)$s.table[1], 
                       summary(FR_l3)$s.table[1], 
                       summary(IT_l3)$s.table[1], 
                       summary(NL_l3)$s.table[1], 
                       summary(DE_l3)$s.table[1], 
                       summary(UK_l3)$s.table[1], 
                       summary(GR_l3)$s.table[1], 
                       summary(PT_l3)$s.table[1], 
                       summary(ES_l3)$s.table[1], 
                       summary(SE_l3)$s.table[1],
                       summary(CZ_l3)$s.table[1], 
                       summary(PL_l3)$s.table[1]), digits=2)

# educ: coef
TableA9[,2] <- round(c(BE_l3$coefficients[2],
                       FR_l3$coefficients[2], 
                       IT_l3$coefficients[2], 
                       NL_l3$coefficients[2], 
                       DE_l3$coefficients[2], 
                       UK_l3$coefficients[2], 
                       GR_l3$coefficients[2], 
                       PT_l3$coefficients[2], 
                       ES_l3$coefficients[2], 
                       SE_l3$coefficients[2], 
                       CZ_l3$coefficients[2], 
                       PL_l3$coefficients[2]), digits = 2)

# Moderate sophistication
# edf
TableA9[,3] <- round(c(summary(BE_m3)$s.table[1], 
                       summary(FR_m3)$s.table[1], 
                       summary(IT_m3)$s.table[1], 
                       summary(NL_m3)$s.table[1], 
                       summary(DE_m3)$s.table[1], 
                       summary(UK_m3)$s.table[1], 
                       summary(GR_m3)$s.table[1], 
                       summary(PT_m3)$s.table[1], 
                       summary(ES_m3)$s.table[1], 
                       summary(SE_m3)$s.table[1],
                       summary(CZ_m3)$s.table[1], 
                       summary(PL_m3)$s.table[1]), digits=2)

# educ: coef
TableA9[,4] <- round(c(BE_m3$coefficients[2],
                       FR_m3$coefficients[2], 
                       IT_m3$coefficients[2], 
                       NL_m3$coefficients[2], 
                       DE_m3$coefficients[2], 
                       UK_m3$coefficients[2], 
                       GR_m3$coefficients[2], 
                       PT_m3$coefficients[2], 
                       ES_m3$coefficients[2], 
                       SE_m3$coefficients[2], 
                       CZ_m3$coefficients[2], 
                       PL_m3$coefficients[2]), digits = 2)

# High sophistication
# edf
TableA9[,5] <- round(c(summary(BE_h3)$s.table[1], 
                       summary(FR_h3)$s.table[1], 
                       summary(IT_h3)$s.table[1], 
                       summary(NL_h3)$s.table[1], 
                       summary(DE_h3)$s.table[1], 
                       summary(UK_h3)$s.table[1], 
                       summary(GR_h3)$s.table[1], 
                       summary(PT_h3)$s.table[1], 
                       summary(ES_h3)$s.table[1], 
                       summary(SE_h3)$s.table[1],
                       summary(CZ_h3)$s.table[1], 
                       summary(PL_h3)$s.table[1]), digits=2)

# educ: coef
TableA9[,6] <- round(c(BE_h3$coefficients[2],
                       FR_h3$coefficients[2], 
                       IT_h3$coefficients[2], 
                       NL_h3$coefficients[2], 
                       DE_h3$coefficients[2], 
                       UK_h3$coefficients[2], 
                       GR_h3$coefficients[2], 
                       PT_h3$coefficients[2], 
                       ES_h3$coefficients[2], 
                       SE_h3$coefficients[2], 
                       CZ_h3$coefficients[2], 
                       PL_h3$coefficients[2]), digits = 2)

TableA9


#---------------------------------------------------------------------------------
# Table A10: M3 Approximate Significance of Smooth Terms for Ideological Effects
#---------------------------------------------------------------------------------

TableA10 <- matrix(NA, 12 , ncol = 9)
colnames(TableA10) <- rep(c("edf", "F Statistic", "p-value"), times=3)
rownames(TableA10) <- c("Belgium","France","Italy","Netherlands","Germany","UK","Greece","Portugal",
                       "Spain","Sweden","Czech Republic","Poland")

# Low Sophistication
# edf
TableA10[,1] <- round(c(summary(BE_l3)$s.table[1], 
                       summary(FR_l3)$s.table[1], 
                       summary(IT_l3)$s.table[1], 
                       summary(NL_l3)$s.table[1], 
                       summary(DE_l3)$s.table[1], 
                       summary(UK_l3)$s.table[1], 
                       summary(GR_l3)$s.table[1], 
                       summary(PT_l3)$s.table[1], 
                       summary(ES_l3)$s.table[1], 
                       summary(SE_l3)$s.table[1],
                       summary(CZ_l3)$s.table[1], 
                       summary(PL_l3)$s.table[1]), digits=2)

# F-Statistic
TableA10[,2] <- round(c(summary(BE_l3)$s.table[3], 
                       summary(FR_l3)$s.table[3], 
                       summary(IT_l3)$s.table[3], 
                       summary(NL_l3)$s.table[3], 
                       summary(DE_l3)$s.table[3], 
                       summary(UK_l3)$s.table[3], 
                       summary(GR_l3)$s.table[3], 
                       summary(PT_l3)$s.table[3], 
                       summary(ES_l3)$s.table[3], 
                       summary(SE_l3)$s.table[3],
                       summary(CZ_l3)$s.table[3], 
                       summary(PL_l3)$s.table[3]), digits=2)

# p-value
TableA10[,3] <- round(c(summary(BE_l3)$s.table[4], 
                       summary(FR_l3)$s.table[4], 
                       summary(IT_l3)$s.table[4], 
                       summary(NL_l3)$s.table[4], 
                       summary(DE_l3)$s.table[4], 
                       summary(UK_l3)$s.table[4], 
                       summary(GR_l3)$s.table[4], 
                       summary(PT_l3)$s.table[4], 
                       summary(ES_l3)$s.table[4], 
                       summary(SE_l3)$s.table[4],
                       summary(CZ_l3)$s.table[4], 
                       summary(PL_l3)$s.table[4]), digits=2)

# Moderate Sophistication
# edf
TableA10[,4] <- round(c(summary(BE_m3)$s.table[1], 
                       summary(FR_m3)$s.table[1], 
                       summary(IT_m3)$s.table[1], 
                       summary(NL_m3)$s.table[1], 
                       summary(DE_m3)$s.table[1], 
                       summary(UK_m3)$s.table[1], 
                       summary(GR_m3)$s.table[1], 
                       summary(PT_m3)$s.table[1], 
                       summary(ES_m3)$s.table[1], 
                       summary(SE_m3)$s.table[1],
                       summary(CZ_m3)$s.table[1], 
                       summary(PL_m3)$s.table[1]), digits=2)

# F-Statistic
TableA10[,5] <- round(c(summary(BE_m3)$s.table[3], 
                       summary(FR_m3)$s.table[3], 
                       summary(IT_m3)$s.table[3], 
                       summary(NL_m3)$s.table[3], 
                       summary(DE_m3)$s.table[3], 
                       summary(UK_m3)$s.table[3], 
                       summary(GR_m3)$s.table[3], 
                       summary(PT_m3)$s.table[3], 
                       summary(ES_m3)$s.table[3], 
                       summary(SE_m3)$s.table[3],
                       summary(CZ_m3)$s.table[3], 
                       summary(PL_m3)$s.table[3]), digits=2)

# p-value
TableA10[,6] <- round(c(summary(BE_m3)$s.table[4], 
                       summary(FR_m3)$s.table[4], 
                       summary(IT_m3)$s.table[4], 
                       summary(NL_m3)$s.table[4], 
                       summary(DE_m3)$s.table[4], 
                       summary(UK_m3)$s.table[4], 
                       summary(GR_m3)$s.table[4], 
                       summary(PT_m3)$s.table[4], 
                       summary(ES_m3)$s.table[4], 
                       summary(SE_m3)$s.table[4],
                       summary(CZ_m3)$s.table[4], 
                       summary(PL_m3)$s.table[4]), digits=2)

# High Sophistication
# edf
TableA10[,7] <- round(c(summary(BE_h3)$s.table[1], 
                       summary(FR_h3)$s.table[1], 
                       summary(IT_h3)$s.table[1], 
                       summary(NL_h3)$s.table[1], 
                       summary(DE_h3)$s.table[1], 
                       summary(UK_h3)$s.table[1], 
                       summary(GR_h3)$s.table[1], 
                       summary(PT_h3)$s.table[1], 
                       summary(ES_h3)$s.table[1], 
                       summary(SE_h3)$s.table[1],
                       summary(CZ_h3)$s.table[1], 
                       summary(PL_h3)$s.table[1]), digits=2)

# F-Statistic
TableA10[,8] <- round(c(summary(BE_h3)$s.table[3], 
                       summary(FR_h3)$s.table[3], 
                       summary(IT_h3)$s.table[3], 
                       summary(NL_h3)$s.table[3], 
                       summary(DE_h3)$s.table[3], 
                       summary(UK_h3)$s.table[3], 
                       summary(GR_h3)$s.table[3], 
                       summary(PT_h3)$s.table[3], 
                       summary(ES_h3)$s.table[3], 
                       summary(SE_h3)$s.table[3],
                       summary(CZ_h3)$s.table[3], 
                       summary(PL_h3)$s.table[3]), digits=2)

# p-value
TableA10[,9] <- round(c(summary(BE_h3)$s.table[4], 
                       summary(FR_h3)$s.table[4], 
                       summary(IT_h3)$s.table[4], 
                       summary(NL_h3)$s.table[4], 
                       summary(DE_h3)$s.table[4], 
                       summary(UK_h3)$s.table[4], 
                       summary(GR_h3)$s.table[4], 
                       summary(PT_h3)$s.table[4], 
                       summary(ES_h3)$s.table[4], 
                       summary(SE_h3)$s.table[4],
                       summary(CZ_h3)$s.table[4], 
                       summary(PL_h3)$s.table[4]), digits=2)

TableA10



#--------------------------------------------------------------------------------------------------
# Table A11: M3: Parametric Coefficients for the Three Settings: Low, Moderate and High Sophistication 
#---------------------------------------------------------------------------------------------------

TableA11 <- matrix(NA, 120, ncol = 9)
colnames(TableA11) <- rep(c("coef.", "s.e.", "p-val."), times=3)
rownames(TableA11) <- rep(c( "Intercept", "Education", "Age", "Female", 
                            "Pop. size: small", "Pop. size: large", 
                            "Interest: little", "Interest: somewhat", "Interest: very", "Undeveloped"), times=12)

# BE
TableA11[1:10,1] <- round(BE_l3$coefficients[1:10], digits=2)
TableA11[1:10,2] <- round(summary(BE_l3)$se[1:10], digits=2)
TableA11[1:10,3] <- round(summary(BE_l3)$p.pv[1:10], digits=2)

TableA11[1:10,4] <- round(BE_m3$coefficients[1:10], digits=2)
TableA11[1:10,5] <- round(summary(BE_m3)$se[1:10], digits=2)
TableA11[1:10,6] <- round(summary(BE_m3)$p.pv[1:10], digits=2)
#
TableA11[1:10,7] <- round(BE_h3$coefficients[1:10], digits=2)
TableA11[1:10,8] <- round(summary(BE_h3)$se[1:10], digits=2)
TableA11[1:10,9] <- round(summary(BE_h3)$p.pv[1:10], digits=2)

# FR
TableA11[11:20,1] <- round(FR_l3$coefficients[1:10], digits=2)
TableA11[11:20,2] <- round(summary(FR_l3)$se[1:10], digits=2)
TableA11[11:20,3] <- round(summary(FR_l3)$p.pv[1:10], digits=2)
#
TableA11[11:20,4] <- round(FR_m3$coefficients[1:10], digits=2)
TableA11[11:20,5] <- round(summary(FR_m3)$se[1:10], digits=2)
TableA11[11:20,6] <- round(summary(FR_m3)$p.pv[1:10], digits=2)
#
TableA11[11:20,7] <- round(FR_h3$coefficients[1:10], digits=2)
TableA11[11:20,8] <- round(summary(FR_h3)$se[1:10], digits=2)
TableA11[11:20,9] <- round(summary(FR_h3)$p.pv[1:10], digits=2)

# IT
TableA11[21:30,1] <- round(IT_l3$coefficients[1:10], digits=2)
TableA11[21:30,2] <- round(summary(IT_l3)$se[1:10], digits=2)
TableA11[21:30,3] <- round(summary(IT_l3)$p.pv[1:10], digits=2)
#
TableA11[21:30,4] <- round(IT_m3$coefficients[1:10], digits=2)
TableA11[21:30,5] <- round(summary(IT_m3)$se[1:10], digits=2)
TableA11[21:30,6] <- round(summary(IT_m3)$p.pv[1:10], digits=2)
#
TableA11[21:30,7] <- round(IT_h3$coefficients[1:10], digits=2)
TableA11[21:30,8] <- round(summary(IT_h3)$se[1:10], digits=2)
TableA11[21:30,9] <- round(summary(IT_h3)$p.pv[1:10], digits=2)

# NL
TableA11[31:40,1] <- round(NL_l3$coefficients[1:10], digits=2)
TableA11[31:40,2] <- round(summary(NL_l3)$se[1:10], digits=2)
TableA11[31:40,3] <- round(summary(NL_l3)$p.pv[1:10], digits=2)
#
TableA11[31:40,4] <- round(NL_m3$coefficients[1:10], digits=2)
TableA11[31:40,5] <- round(summary(NL_m3)$se[1:10], digits=2)
TableA11[31:40,6] <- round(summary(NL_m3)$p.pv[1:10], digits=2)
#
TableA11[31:40,7] <- round(NL_h3$coefficients[1:10], digits=2)
TableA11[31:40,8] <- round(summary(NL_h3)$se[1:10], digits=2)
TableA11[31:40,9] <- round(summary(NL_h3)$p.pv[1:10], digits=2)

# DE
TableA11[41:50,1] <- round(DE_l3$coefficients[1:10], digits=2)
TableA11[41:50,2] <- round(summary(DE_l3)$se[1:10], digits=2)
TableA11[41:50,3] <- round(summary(DE_l3)$p.pv[1:10], digits=2)
#
TableA11[41:50,4] <- round(DE_m3$coefficients[1:10], digits=2)
TableA11[41:50,5] <- round(summary(DE_m3)$se[1:10], digits=2)
TableA11[41:50,6] <- round(summary(DE_m3)$p.pv[1:10], digits=2)
#
TableA11[41:50,7] <- round(DE_h3$coefficients[1:10], digits=2)
TableA11[41:50,8] <- round(summary(DE_h3)$se[1:10], digits=2)
TableA11[41:50,9] <- round(summary(DE_h3)$p.pv[1:10], digits=2)

# UK
TableA11[51:60,1] <- round(UK_l3$coefficients[1:10], digits=2)
TableA11[51:60,2] <- round(summary(UK_l3)$se[1:10], digits=2)
TableA11[51:60,3] <- round(summary(UK_l3)$p.pv[1:10], digits=2)
#
TableA11[51:60,4] <- round(UK_m3$coefficients[1:10], digits=2)
TableA11[51:60,5] <- round(summary(UK_m3)$se[1:10], digits=2)
TableA11[51:60,6] <- round(summary(UK_m3)$p.pv[1:10], digits=2)
#
TableA11[51:60,7] <- round(UK_h3$coefficients[1:10], digits=2)
TableA11[51:60,8] <- round(summary(UK_h3)$se[1:10], digits=2)
TableA11[51:60,9] <- round(summary(UK_h3)$p.pv[1:10], digits=2)

# GR
TableA11[61:70,1] <- round(GR_l3$coefficients[1:10], digits=2)
TableA11[61:70,2] <- round(summary(GR_l3)$se[1:10], digits=2)
TableA11[61:70,3] <- round(summary(GR_l3)$p.pv[1:10], digits=2)
#
TableA11[61:70,4] <- round(GR_m3$coefficients[1:10], digits=2)
TableA11[61:70,5] <- round(summary(GR_m3)$se[1:10], digits=2)
TableA11[61:70,6] <- round(summary(GR_m3)$p.pv[1:10], digits=2)
#
TableA11[61:70,7] <- round(GR_h3$coefficients[1:10], digits=2)
TableA11[61:70,8] <- round(summary(GR_h3)$se[1:10], digits=2)
TableA11[61:70,9] <- round(summary(GR_h3)$p.pv[1:10], digits=2)

# PT
TableA11[71:80,1] <- round(PT_l3$coefficients[1:10], digits=2)
TableA11[71:80,2] <- round(summary(PT_l3)$se[1:10], digits=2)
TableA11[71:80,3] <- round(summary(PT_l3)$p.pv[1:10], digits=2)
#
TableA11[71:80,4] <- round(PT_m3$coefficients[1:10], digits=2)
TableA11[71:80,5] <- round(summary(PT_m3)$se[1:10], digits=2)
TableA11[71:80,6] <- round(summary(PT_m3)$p.pv[1:10], digits=2)
#
TableA11[71:80,7] <- round(PT_h3$coefficients[1:10], digits=2)
TableA11[71:80,8] <- round(summary(PT_h3)$se[1:10], digits=2)
TableA11[71:80,9] <- round(summary(PT_h3)$p.pv[1:10], digits=2)

# ES
TableA11[81:90,1] <- round(ES_l3$coefficients[1:10], digits=2)
TableA11[81:90,2] <- round(summary(ES_l3)$se[1:10], digits=2)
TableA11[81:90,3] <- round(summary(ES_l3)$p.pv[1:10], digits=2)
#
TableA11[81:90,4] <- round(ES_m3$coefficients[1:10], digits=2)
TableA11[81:90,5] <- round(summary(ES_m3)$se[1:10], digits=2)
TableA11[81:90,6] <- round(summary(ES_m3)$p.pv[1:10], digits=2)
#
TableA11[81:90,7] <- round(ES_h3$coefficients[1:10], digits=2)
TableA11[81:90,8] <- round(summary(ES_h3)$se[1:10], digits=2)
TableA11[81:90,9] <- round(summary(ES_h3)$p.pv[1:10], digits=2)

# SE
TableA11[91:100,1] <- round(SE_l3$coefficients[1:10], digits=2)
TableA11[91:100,2] <- round(summary(SE_l3)$se[1:10], digits=2)
TableA11[91:100,3] <- round(summary(SE_l3)$p.pv[1:10], digits=2)
#
TableA11[91:100,4] <- round(SE_m3$coefficients[1:10], digits=2)
TableA11[91:100,5] <- round(summary(SE_m3)$se[1:10], digits=2)
TableA11[91:100,6] <- round(summary(SE_m3)$p.pv[1:10], digits=2)
#
TableA11[91:100,7] <- round(SE_h3$coefficients[1:10], digits=2)
TableA11[91:100,8] <- round(summary(SE_h3)$se[1:10], digits=2)
TableA11[91:100,9] <- round(summary(SE_h3)$p.pv[1:10], digits=2)

# CZ
TableA11[101:110,1] <- round(CZ_l3$coefficients[1:10], digits=2)
TableA11[101:110,2] <- round(summary(CZ_l3)$se[1:10], digits=2)
TableA11[101:110,3] <- round(summary(CZ_l3)$p.pv[1:10], digits=2)
#
TableA11[101:110,4] <- round(CZ_m3$coefficients[1:10], digits=2)
TableA11[101:110,5] <- round(summary(CZ_m3)$se[1:10], digits=2)
TableA11[101:110,6] <- round(summary(CZ_m3)$p.pv[1:10], digits=2)
#
TableA11[101:110,7] <- round(CZ_h3$coefficients[1:10], digits=2)
TableA11[101:110,8] <- round(summary(CZ_h3)$se[1:10], digits=2)
TableA11[101:110,9] <- round(summary(CZ_h3)$p.pv[1:10], digits=2)

# PL
TableA11[111:120,1] <- round(PL_l3$coefficients[1:10], digits=2)
TableA11[111:120,2] <- round(summary(PL_l3)$se[1:10], digits=2)
TableA11[111:120,3] <- round(summary(PL_l3)$p.pv[1:10], digits=2)
#
TableA11[111:120,4] <- round(PL_m3$coefficients[1:10], digits=2)
TableA11[111:120,5] <- round(summary(PL_m3)$se[1:10], digits=2)
TableA11[111:120,6] <- round(summary(PL_m3)$p.pv[1:10], digits=2)
#
TableA11[111:120,7] <- round(PL_h3$coefficients[1:10], digits=2)
TableA11[111:120,8] <- round(summary(PL_h3)$se[1:10], digits=2)
TableA11[111:120,9] <- round(summary(PL_h3)$p.pv[1:10], digits=2)

TableA11


############################################################################
# E.2 Measuring EU Policies by Governing Parties in the European Commission
#############################################################################


#--------------------------------------------------------------------------------------------
# Table A13: M2: European Commission: Ideological Effects s(ideo_i) and Economic Effects e_i
#--------------------------------------------------------------------------------------------
# no values for UK and GR in h2_com
TableA13 <- matrix(NA, 12 , ncol = 4)
colnames(TableA13) <- rep(c("edf", "eco: coef"), times=2)
rownames(TableA13) <- c("Belgium","France","Italy","Netherlands", "Germany","UK","Greece","Portugal",
                        "Spain","Sweden","Czech Republic","Poland")


# Moderate sophistication
# edf
TableA13[,1] <- round(c(summary(BE_m2_com)$s.table[1], 
                        summary(FR_m2_com)$s.table[1], 
                        summary(IT_m2_com)$s.table[1], 
                        summary(NL_m2_com)$s.table[1], 
                        summary(DE_m2_com)$s.table[1], 
                        summary(UK_m2_com)$s.table[1], 
                        summary(GR_m2_com)$s.table[1], 
                        summary(PT_m2_com)$s.table[1], 
                        summary(ES_m2_com)$s.table[1], 
                        summary(SE_m2_com)$s.table[1],
                        summary(CZ_m2_com)$s.table[1], 
                        summary(PL_m2_com)$s.table[1]), digits=2)

# eco: coef
TableA13[,2] <- round(c(BE_m2_com$coefficients[2],
                        FR_m2_com$coefficients[2], 
                        IT_m2_com$coefficients[2], 
                        NL_m2_com$coefficients[2], 
                        DE_m2_com$coefficients[2], 
                        UK_m2_com$coefficients[2], 
                        GR_m2_com$coefficients[2], 
                        PT_m2_com$coefficients[2], 
                        ES_m2_com$coefficients[2], 
                        SE_m2_com$coefficients[2], 
                        CZ_m2_com$coefficients[2], 
                        PL_m2_com$coefficients[2]), digits = 2)

# High sophistication
# edf
TableA13[,3] <- round(c(summary(BE_h2_com)$s.table[1], 
                        summary(FR_h2_com)$s.table[1], 
                        summary(IT_h2_com)$s.table[1], 
                        summary(NL_h2_com)$s.table[1], 
                        summary(DE_h2_com)$s.table[1], 
                        0, 
                        0, 
                        summary(PT_h2_com)$s.table[1], 
                        summary(ES_h2_com)$s.table[1], 
                        summary(SE_h2_com)$s.table[1],
                        summary(CZ_h2_com)$s.table[1], 
                        summary(PL_h2_com)$s.table[1]), digits=2)

# eco: coef
TableA13[,4] <- round(c(BE_h2_com$coefficients[2],
                        FR_h2_com$coefficients[2], 
                        IT_h2_com$coefficients[2], 
                        NL_h2_com$coefficients[2], 
                        DE_h2_com$coefficients[2], 
                        0, 
                        0, 
                        PT_h2_com$coefficients[2], 
                        ES_h2_com$coefficients[2], 
                        SE_h2_com$coefficients[2], 
                        CZ_h2_com$coefficients[2], 
                        PL_h2_com$coefficients[2]), digits = 2)

TableA13


#-----------------------------------------------------------------------------------------------------------------
# Table A14: M2: European Commission: Approximate Significance of Smooth Terms for Ideological Effects s(ideo_i)
#------------------------------------------------------------------------------------------------------------------

# no values for UK and GR in h2_com
TableA14 <- matrix(NA, 12 , ncol = 6)
colnames(TableA14) <- rep(c("edf", "F-Statistic", "p-val."), times=2)
rownames(TableA14) <- c("Belgium","France","Italy","Netherlands","Germany","UK","Greece","Portugal",
                            "Spain","Sweden","Czech Republic","Poland")

# moderate
# edf
TableA14[,1] <- round(c(summary(BE_m2_com)$s.table[1],
                        summary(FR_m2_com)$s.table[1], 
                        summary(IT_m2_com)$s.table[1], 
                        summary(NL_m2_com)$s.table[1], 
                        summary(DE_m2_com)$s.table[1], 
                        summary(UK_m2_com)$s.table[1], 
                        summary(GR_m2_com)$s.table[1], 
                        summary(PT_m2_com)$s.table[1], 
                        summary(ES_m2_com)$s.table[1], 
                        summary(SE_m2_com)$s.table[1], 
                        summary(CZ_m2_com)$s.table[1], 
                        summary(PL_m2_com)$s.table[1]), digits=2)

# F-Statistic
TableA14[,2] <- round(c(summary(BE_m2_com)$s.table[3],
                        summary(FR_m2_com)$s.table[3], 
                        summary(IT_m2_com)$s.table[3], 
                        summary(NL_m2_com)$s.table[3], 
                        summary(DE_m2_com)$s.table[3], 
                        summary(UK_m2_com)$s.table[3], 
                        summary(GR_m2_com)$s.table[3], 
                        summary(PT_m2_com)$s.table[3], 
                        summary(ES_m2_com)$s.table[3], 
                        summary(SE_m2_com)$s.table[3], 
                        summary(CZ_m2_com)$s.table[3], 
                        summary(PL_m2_com)$s.table[3]), digits=2) 

# p-value
TableA14[,3] <- round(c(summary(BE_m2_com)$s.table[4],
                        summary(FR_m2_com)$s.table[4], 
                        summary(IT_m2_com)$s.table[4], 
                        summary(NL_m2_com)$s.table[4], 
                        summary(DE_m2_com)$s.table[4], 
                        summary(UK_m2_com)$s.table[4], 
                        summary(GR_m2_com)$s.table[4], 
                        summary(PT_m2_com)$s.table[4], 
                        summary(ES_m2_com)$s.table[4], 
                        summary(SE_m2_com)$s.table[4], 
                        summary(CZ_m2_com)$s.table[4], 
                        summary(PL_m2_com)$s.table[4]), digits=2) 

# high
# edf
TableA14[,4] <- round(c(summary(BE_h2_com)$s.table[1],
                        summary(FR_h2_com)$s.table[1], 
                        summary(IT_h2_com)$s.table[1], 
                        summary(NL_h2_com)$s.table[1], 
                        summary(DE_h2_com)$s.table[1], 
                        0, 
                        0, 
                        summary(PT_h2_com)$s.table[1], 
                        summary(ES_h2_com)$s.table[1], 
                        summary(SE_h2_com)$s.table[1], 
                        summary(CZ_h2_com)$s.table[1], 
                        summary(PL_h2_com)$s.table[1]), digits=2)

# F-Statistic
TableA14[,5] <- round(c(summary(BE_h2_com)$s.table[3],
                        summary(FR_h2_com)$s.table[3], 
                        summary(IT_h2_com)$s.table[3], 
                        summary(NL_h2_com)$s.table[3], 
                        summary(DE_h2_com)$s.table[3], 
                        0, 
                        0, 
                        summary(PT_h2_com)$s.table[3], 
                        summary(ES_h2_com)$s.table[3], 
                        summary(SE_h2_com)$s.table[3], 
                        summary(CZ_h2_com)$s.table[3], 
                        summary(PL_h2_com)$s.table[3]), digits=2) 

# p-value
TableA14[,6] <- round(c(summary(BE_h2_com)$s.table[4],
                        summary(FR_h2_com)$s.table[4], 
                        summary(IT_h2_com)$s.table[4], 
                        summary(NL_h2_com)$s.table[4], 
                        summary(DE_h2_com)$s.table[4], 
                        0, 
                        0, 
                        summary(PT_h2_com)$s.table[4], 
                        summary(ES_h2_com)$s.table[4], 
                        summary(SE_h2_com)$s.table[4], 
                        summary(CZ_h2_com)$s.table[4], 
                        summary(PL_h2_com)$s.table[4]), digits=2) 

TableA14


#-------------------------------------------------------------------------------------------------
# Table A15: M2: European Commission: Parametric Coefficients for Moderate and High Sophistication 
#--------------------------------------------------------------------------------------------------
# only moderate and high
# no models for UK and Greece in h2_com

TableA15 <- matrix(NA, 120, ncol = 6)
colnames(TableA15) <- rep(c("coef.", "s.e.", "p-val."), times=2)
rownames(TableA15) <- rep(c( "Intercept", "Economic Status", "Age", "Female", 
                             "Pop. size: small", "Pop. size: large", 
                             "Interest: little", "Interest: somewhat", "Interest: very", "Undeveloped"), times=12)

# BE
TableA15[1:10,1] <- round(BE_m2_com$coefficients[1:10], digits=2)
TableA15[1:10,2] <- round(summary(BE_m2_com)$se[1:10], digits=2)
TableA15[1:10,3] <- round(summary(BE_m2_com)$p.pv[1:10], digits=2)
#
TableA15[1:10,4] <- round(BE_h2_com$coefficients[1:10], digits=2)
TableA15[1:10,5] <- round(summary(BE_h2_com)$se[1:10], digits=2)
TableA15[1:10,6] <- round(summary(BE_h2_com)$p.pv[1:10], digits=2)

# FR
TableA15[11:20,1] <- round(FR_m2_com$coefficients[1:10], digits=2)
TableA15[11:20,2] <- round(summary(FR_m2_com)$se[1:10], digits=2)
TableA15[11:20,3] <- round(summary(FR_m2_com)$p.pv[1:10], digits=2)
#
TableA15[11:20,4] <- round(FR_h2_com$coefficients[1:10], digits=2)
TableA15[11:20,5] <- round(summary(FR_h2_com)$se[1:10], digits=2)
TableA15[11:20,6] <- round(summary(FR_h2_com)$p.pv[1:10], digits=2)

# IT
TableA15[21:30,1] <- round(IT_m2_com$coefficients[1:10], digits=2)
TableA15[21:30,2] <- round(summary(IT_m2_com)$se[1:10], digits=2)
TableA15[21:30,3] <- round(summary(IT_m2_com)$p.pv[1:10], digits=2)
#
TableA15[21:30,4] <- round(IT_h2_com$coefficients[1:10], digits=2)
TableA15[21:30,5] <- round(summary(IT_h2_com)$se[1:10], digits=2)
TableA15[21:30,6] <- round(summary(IT_h2_com)$p.pv[1:10], digits=2)

# NL
TableA15[31:40,1] <- round(NL_m2_com$coefficients[1:10], digits=2)
TableA15[31:40,2] <- round(summary(NL_m2_com)$se[1:10], digits=2)
TableA15[31:40,3] <- round(summary(NL_m2_com)$p.pv[1:10], digits=2)
#
TableA15[31:40,4] <- round(NL_h2_com$coefficients[1:10], digits=2)
TableA15[31:40,5] <- round(summary(NL_h2_com)$se[1:10], digits=2)
TableA15[31:40,6] <- round(summary(NL_h2_com)$p.pv[1:10], digits=2)

# DE
TableA15[41:50,1] <- round(DE_m2_com$coefficients[1:10], digits=2)
TableA15[41:50,2] <- round(summary(DE_m2_com)$se[1:10], digits=2)
TableA15[41:50,3] <- round(summary(DE_m2_com)$p.pv[1:10], digits=2)
#
TableA15[41:50,4] <- round(DE_h2_com$coefficients[1:10], digits=2)
TableA15[41:50,5] <- round(summary(DE_h2_com)$se[1:10], digits=2)
TableA15[41:50,6] <- round(summary(DE_h2_com)$p.pv[1:10], digits=2)

# UK
TableA15[51:60,1] <- round(UK_m2_com$coefficients[1:10], digits=2)
TableA15[51:60,2] <- round(summary(UK_m2_com)$se[1:10], digits=2)
TableA15[51:60,3] <- round(summary(UK_m2_com)$p.pv[1:10], digits=2)
#
#TableA15[51:60,4] <- 0
#TableA15[51:60,5] <- 0
#TableA15[51:60,6] <- 0

# GR
TableA15[61:70,1] <- round(GR_m2_com$coefficients[1:10], digits=2)
TableA15[61:70,2] <- round(summary(GR_m2_com)$se[1:10], digits=2)
TableA15[61:70,3] <- round(summary(GR_m2_com)$p.pv[1:10], digits=2)
#
#TableA15[61:70,4] <- 0
#TableA15[61:70,5] <- 0
#TableA15[61:70,6] <- 0

# PT
TableA15[71:80,1] <- round(PT_m2_com$coefficients[1:10], digits=2)
TableA15[71:80,2] <- round(summary(PT_m2_com)$se[1:10], digits=2)
TableA15[71:80,3] <- round(summary(PT_m2_com)$p.pv[1:10], digits=2)
#
TableA15[71:80,4] <- round(PT_h2_com$coefficients[1:10], digits=2)
TableA15[71:80,5] <- round(summary(PT_h2_com)$se[1:10], digits=2)
TableA15[71:80,6] <- round(summary(PT_h2_com)$p.pv[1:10], digits=2)

# ES
TableA15[81:90,1] <- round(ES_m2_com$coefficients[1:10], digits=2)
TableA15[81:90,2] <- round(summary(ES_m2_com)$se[1:10], digits=2)
TableA15[81:90,3] <- round(summary(ES_m2_com)$p.pv[1:10], digits=2)
#
TableA15[81:90,4] <- round(ES_h2_com$coefficients[1:10], digits=2)
TableA15[81:90,5] <- round(summary(ES_h2_com)$se[1:10], digits=2)
TableA15[81:90,6] <- round(summary(ES_h2_com)$p.pv[1:10], digits=2)

# SE
TableA15[91:100,1] <- round(SE_m2_com$coefficients[1:10], digits=2)
TableA15[91:100,2] <- round(summary(SE_m2_com)$se[1:10], digits=2)
TableA15[91:100,3] <- round(summary(SE_m2_com)$p.pv[1:10], digits=2)
#
TableA15[91:100,4] <- round(SE_h2_com$coefficients[1:10], digits=2)
TableA15[91:100,5] <- round(summary(SE_h2_com)$se[1:10], digits=2)
TableA15[91:100,6] <- round(summary(SE_h2_com)$p.pv[1:10], digits=2)

# CZ
TableA15[101:110,1] <- round(CZ_m2_com$coefficients[1:10], digits=2)
TableA15[101:110,2] <- round(summary(CZ_m2_com)$se[1:10], digits=2)
TableA15[101:110,3] <- round(summary(CZ_m2_com)$p.pv[1:10], digits=2)
#
TableA15[101:110,4] <- round(CZ_h2_com$coefficients[1:10], digits=2)
TableA15[101:110,5] <- round(summary(CZ_h2_com)$se[1:10], digits=2)
TableA15[101:110,6] <- round(summary(CZ_h2_com)$p.pv[1:10], digits=2)

# PL
TableA15[111:120,1] <- round(PL_m2_com$coefficients[1:10], digits=2)
TableA15[111:120,2] <- round(summary(PL_m2_com)$se[1:10], digits=2)
TableA15[111:120,3] <- round(summary(PL_m2_com)$p.pv[1:10], digits=2)
#
TableA15[111:120,4] <- round(PL_h2_com$coefficients[1:10], digits=2)
TableA15[111:120,5] <- round(summary(PL_h2_com)$se[1:10], digits=2)
TableA15[111:120,6] <- round(summary(PL_h2_com)$p.pv[1:10], digits=2)

TableA15



###############################################
# E.3 Model with ideo_i = |xi - xin|
###############################################

#----------------------------------------------------------------------------------------------------------------
# Table A16: M2: Ideological Effects s(ideo_i) and Economic Effects e_i for the Model with ideoi = |xi - xin|
#----------------------------------------------------------------------------------------------------------------
TableA16 <- matrix(NA, 12 , ncol = 2)
colnames(TableA16) <- c("edf", "eco: coef")
rownames(TableA16) <- c("Belgium","France","Italy","Netherlands", "Germany","UK","Greece","Portugal",
                        "Spain","Sweden","Czech Republic","Poland")

# edf
TableA16[,1] <- round(c(summary(BE_2_Rdis)$s.table[1], 
                        summary(FR_2_Rdis)$s.table[1], 
                        summary(IT_2_Rdis)$s.table[1], 
                        summary(NL_2_Rdis)$s.table[1], 
                        summary(DE_2_Rdis)$s.table[1], 
                        summary(UK_2_Rdis)$s.table[1], 
                        summary(GR_2_Rdis)$s.table[1], 
                        summary(PT_2_Rdis)$s.table[1], 
                        summary(ES_2_Rdis)$s.table[1], 
                        summary(SE_2_Rdis)$s.table[1],
                        summary(CZ_2_Rdis)$s.table[1], 
                        summary(PL_2_Rdis)$s.table[1]), digits=2)

# eco: coef
TableA16[,2] <- round(c(BE_2_Rdis$coefficients[2],
                        FR_2_Rdis$coefficients[2], 
                        IT_2_Rdis$coefficients[2], 
                        NL_2_Rdis$coefficients[2], 
                        DE_2_Rdis$coefficients[2], 
                        UK_2_Rdis$coefficients[2], 
                        GR_2_Rdis$coefficients[2], 
                        PT_2_Rdis$coefficients[2], 
                        ES_2_Rdis$coefficients[2], 
                        SE_2_Rdis$coefficients[2], 
                        CZ_2_Rdis$coefficients[2], 
                        PL_2_Rdis$coefficients[2]), digits = 2)


TableA16


#-----------------------------------------------------------------------------------------------
# Table A17: M2: Approximate Significance of Smooth Terms for the Model with ideoi = |xi - xin| 
#------------------------------------------------------------------------------------------------
TableA17 <- matrix(NA, 12 , ncol = 3)
colnames(TableA17) <- c("edf", "F-Statistic", "p-val.")
rownames(TableA17) <- c("Belgium","France","Italy","Netherlands", "Germany","UK","Greece","Portugal",
                        "Spain","Sweden","Czech Republic","Poland")

# edf
TableA17[,1] <- round(c(summary(BE_2_Rdis)$s.table[1],
                        summary(FR_2_Rdis)$s.table[1], 
                        summary(IT_2_Rdis)$s.table[1], 
                        summary(NL_2_Rdis)$s.table[1], 
                        summary(DE_2_Rdis)$s.table[1], 
                        summary(UK_2_Rdis)$s.table[1], 
                        summary(GR_2_Rdis)$s.table[1], 
                        summary(PT_2_Rdis)$s.table[1], 
                        summary(ES_2_Rdis)$s.table[1], 
                        summary(SE_2_Rdis)$s.table[1], 
                        summary(CZ_2_Rdis)$s.table[1], 
                        summary(PL_2_Rdis)$s.table[1]), digits=2)

# F-Statistic
TableA17[,2] <- round(c(summary(BE_2_Rdis)$s.table[3],
                        summary(FR_2_Rdis)$s.table[3], 
                        summary(IT_2_Rdis)$s.table[3], 
                        summary(NL_2_Rdis)$s.table[3], 
                        summary(DE_2_Rdis)$s.table[3], 
                        summary(UK_2_Rdis)$s.table[3], 
                        summary(GR_2_Rdis)$s.table[3], 
                        summary(PT_2_Rdis)$s.table[3], 
                        summary(ES_2_Rdis)$s.table[3], 
                        summary(SE_2_Rdis)$s.table[3], 
                        summary(CZ_2_Rdis)$s.table[3], 
                        summary(PL_2_Rdis)$s.table[3]), digits=2) 

# p-value
TableA17[,3] <- round(c(summary(BE_2_Rdis)$s.table[4],
                        summary(FR_2_Rdis)$s.table[4], 
                        summary(IT_2_Rdis)$s.table[4], 
                        summary(NL_2_Rdis)$s.table[4], 
                        summary(DE_2_Rdis)$s.table[4], 
                        summary(UK_2_Rdis)$s.table[4], 
                        summary(GR_2_Rdis)$s.table[4], 
                        summary(PT_2_Rdis)$s.table[4], 
                        summary(ES_2_Rdis)$s.table[4], 
                        summary(SE_2_Rdis)$s.table[4], 
                        summary(CZ_2_Rdis)$s.table[4], 
                        summary(PL_2_Rdis)$s.table[4]), digits=2) 

TableA17


#---------------------------------------------------------------------------------
# Table A18: M2: Parametric Coefficients for the Model with ideoi = |xi - xin|
#---------------------------------------------------------------------------------

TableA18 <- matrix(NA, 120, ncol = 3)
colnames(TableA18) <- c("coef.", "s.e.", "p-val.")
rownames(TableA18) <- rep(c( "Intercept", "Economic Status", "Age", "Female", 
                                 "Pop. size: small", "Pop. size: large", 
                                 "Interest: little", "Interest: somewhat", "Interest: very", "Undeveloped"), times=12)

# BE
TableA18[1:10,1] <- round(BE_2_Rdis$coefficients[1:10], digits=2)
TableA18[1:10,2] <- round(summary(BE_2_Rdis)$se[1:10], digits=2)
TableA18[1:10,3] <- round(summary(BE_2_Rdis)$p.pv[1:10], digits=2)

# FR
TableA18[11:20,1] <- round(FR_2_Rdis$coefficients[1:10], digits=2)
TableA18[11:20,2] <- round(summary(FR_2_Rdis)$se[1:10], digits=2)
TableA18[11:20,3] <- round(summary(FR_2_Rdis)$p.pv[1:10], digits=2)

# IT
TableA18[21:30,1] <- round(IT_2_Rdis$coefficients[1:10], digits=2)
TableA18[21:30,2] <- round(summary(IT_2_Rdis)$se[1:10], digits=2)
TableA18[21:30,3] <- round(summary(IT_2_Rdis)$p.pv[1:10], digits=2)

# NL
TableA18[31:40,1] <- round(NL_2_Rdis$coefficients[1:10], digits=2)
TableA18[31:40,2] <- round(summary(NL_2_Rdis)$se[1:10], digits=2)
TableA18[31:40,3] <- round(summary(NL_2_Rdis)$p.pv[1:10], digits=2)

# DE
TableA18[41:50,1] <- round(DE_2_Rdis$coefficients[1:10], digits=2)
TableA18[41:50,2] <- round(summary(DE_2_Rdis)$se[1:10], digits=2)
TableA18[41:50,3] <- round(summary(DE_2_Rdis)$p.pv[1:10], digits=2)

# UK
TableA18[51:60,1] <- round(UK_2_Rdis$coefficients[1:10], digits=2)
TableA18[51:60,2] <- round(summary(UK_2_Rdis)$se[1:10], digits=2)
TableA18[51:60,3] <- round(summary(UK_2_Rdis)$p.pv[1:10], digits=2)

# GR
TableA18[61:70,1] <- round(GR_2_Rdis$coefficients[1:10], digits=2)
TableA18[61:70,2] <- round(summary(GR_2_Rdis)$se[1:10], digits=2)
TableA18[61:70,3] <- round(summary(GR_2_Rdis)$p.pv[1:10], digits=2)

# PT
TableA18[71:80,1] <- round(PT_2_Rdis$coefficients[1:10], digits=2)
TableA18[71:80,2] <- round(summary(PT_2_Rdis)$se[1:10], digits=2)
TableA18[71:80,3] <- round(summary(PT_2_Rdis)$p.pv[1:10], digits=2)

# ES
TableA18[81:90,1] <- round(ES_2_Rdis$coefficients[1:10], digits=2)
TableA18[81:90,2] <- round(summary(ES_2_Rdis)$se[1:10], digits=2)
TableA18[81:90,3] <- round(summary(ES_2_Rdis)$p.pv[1:10], digits=2)


# SE
TableA18[91:100,1] <- round(SE_2_Rdis$coefficients[1:10], digits=2)
TableA18[91:100,2] <- round(summary(SE_2_Rdis)$se[1:10], digits=2)
TableA18[91:100,3] <- round(summary(SE_2_Rdis)$p.pv[1:10], digits=2)


# CZ
TableA18[101:110,1] <- round(CZ_2_Rdis$coefficients[1:10], digits=2)
TableA18[101:110,2] <- round(summary(CZ_2_Rdis)$se[1:10], digits=2)
TableA18[101:110,3] <- round(summary(CZ_2_Rdis)$p.pv[1:10], digits=2)

# PL
TableA18[111:120,1] <- round(PL_2_Rdis$coefficients[1:10], digits=2)
TableA18[111:120,2] <- round(summary(PL_2_Rdis)$se[1:10], digits=2)
TableA18[111:120,3] <- round(summary(PL_2_Rdis)$p.pv[1:10], digits=2)

TableA18

